Sam Kohnson Sam Kohnson - 9 months ago 71
Android Question

cannot resolve symbol fragmentcontainer

So I've decide to go back into android developing after dropping it for a bit. I Restarted making an old project in android studio I ran into a issue where I'm getting "cannot resolve symbol fragmentcontainer" and I'm sure it was working last time.

import android.os.Bundle;

public class MainActivity extends FragmentActivity {

protected void onCreate(Bundle savedInstanceState) {

// add fragment to the activity
FragmentManager fm = getSupportFragmentManager();

// give fragment to manage
Fragment fragment = fm.findFragmentById(;

if (fragment == null) {
fragment = new HomeFragment();
fm.beginTransaction().add(, fragment)



It looks like your Activity layout R.layout.activity_main does not contain a view with id fragmentContainer. If that's not the issue, check this related question: Android Studio cannot resolve symbol but code executes correctly.