Android Studio Showing imports error

不打扰是莪最后的温柔 提交于 2019-12-11 15:22:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!