问题
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.
回答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.
回答2:
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.
回答3:
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.
来源:https://stackoverflow.com/questions/51771307/android-studio-showing-imports-error