cannot find symbol in Android Studio without rebuilding project

て烟熏妆下的殇ゞ 提交于 2019-11-29 16:19:01

问题


When I try to deploy my project to the emulator the compile fails with a bunch of Cannot find symbol errors. I have to rebuild the project then deploy everytime I make a change. This just started in 0.1.6 for me. Anyone else seeing this?


回答1:


As a temporary workaround, try turning off Preferences > Compiler > Use External Build.

(as suggested in this issue: https://code.google.com/p/android/issues/detail?id=56884)




回答2:


Clicking "Sync project with Gradle files" resolved this for me.




回答3:


I used the following answer and it worked great:

https://stackoverflow.com/a/19223269/1531683

You can do "File" -> "Invalidate Caches...", and select "Invalidate and Restart" option to fix this.




回答4:


Same here. Check this for updates: https://code.google.com/p/android/issues/detail?id=56884&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars




回答5:


As a workaround, deleting the out folder before rebuilding the project solves the problem!




回答6:


Just Click Build -> Clean Project. It will solve the problem of missing "R.java".




回答7:


Adding the following into the dependencies worked for me:

compile 'com.android.support:appcompat-v7:20.+' compile 'com.android.support:support-v4:21.0.0'




回答8:


Using java 7 inner classes instead of lambda functions provided by retro-lambda solved my issue.



来源:https://stackoverflow.com/questions/17241855/cannot-find-symbol-in-android-studio-without-rebuilding-project

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