2

So I just created an app and the MainActivity.java already has compiler errors:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_start_screen);

    mVisible = true;
    mControlsView = findViewById(R.id.fullscreen_content_controls);
    mContentView = findViewById(R.id.fullscreen_content);

The error is

cannot resolve symbol 'r'

I saw this question can not resolve R in android studio? , but it cleaning and rebuilding my project did not yeild any results.

Community
  • 1
  • 1

4 Answers4

1

There are lots of Possible Solution

Solution 1:

Clean and Rebuild the Project

Solution 2 :

Close Android Studio and Open Again.

Solution 3 :

Try Invalidate caches and Restart and select Restart option.

Harshad Pansuriya
  • 20,189
  • 8
  • 67
  • 95
0

This error happens sometimes. Happened to me quite a few times. I just restarted the project and Synchronized the Gradle (Sync Project with Gradle Files) and it went back to normal. Try that. It may work for you as well.

0

you could re-start all(android studio,cache,system). it will recover.

0

In my case, the peoblem caused by "junit test" package. See this link for more information: https://stackoverflow.com/a/41410648/5780236

Community
  • 1
  • 1