0

I previously had this issue but after this issue was resolved a new issue started coming up.

The imports are showing error Cannot resolve the symbol x.

For ex All the below are showing error.

import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.WindowManager;
import android.widget.LinearLayout;

I have tested this on two project and for both the projects it is showing error. Any help would be grateful.

Rajesh K
  • 683
  • 2
  • 9
  • 35

3 Answers3

1

Sometimes Android Studio messes up the R.java and the indexes. And, only way to correct it is Gradle sync.

Restart, Clean and Rebuild the project.

  • 1
    Sorry but your solution did not work. I Had to reinstall the Android Studio. But any way thanks for the help. – Rajesh K Aug 10 '18 at 15:18
1

Try to sync your project and rebuild. If that doesn't solve the issue try

File > Invalidate Caches > Invalidate and Restart.

If your problem is still not fixed, and you get and SDK error on trying to run your project, move your project directory to some place else and open it again in Android Studio.

VishnuVS
  • 1,055
  • 2
  • 14
  • 29
1

Tried all the solution present in the web and other Stack overflow posts but non of them worked.

Finally I had to reinstall the Android Studio which solved the issue for me.

Rajesh K
  • 683
  • 2
  • 9
  • 35