31

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?

Androiderson
  • 16,865
  • 6
  • 62
  • 72
Adam Johns
  • 35,397
  • 25
  • 123
  • 176
  • 1
    Someone from google mentioned: As a temporary workaround, try turning off Preferences > Compiler > Use External Build. – Adam Johns Jun 21 '13 at 20:43
  • 2
    I seem to have new problems with every version of Android Studio. I realize it is in beta, but you would think a company as big as Google could do regression testing before deploying a new version. – kwahn Jun 25 '13 at 15:25

8 Answers8

22

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)

Csongor Kiss
  • 715
  • 6
  • 11
  • 14
    There is no "Use External Build" option in 0.3.1. I'm not sure which version removed it. –  Oct 28 '13 at 22:29
  • 2
    If you modify the id of a view in one of your layout files that will force Android Studio to rebuild the R file before running. I use this workaround to bypass having to rebuild. – Software.Developer Feb 11 '14 at 19:52
7

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

enter image description here

Ken
  • 30,811
  • 34
  • 116
  • 155
6

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.

Community
  • 1
  • 1
sadegh saati
  • 1,168
  • 1
  • 13
  • 24
3

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

Muddassir Iqbal
  • 142
  • 1
  • 1
  • 12
2

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

StackOverflower
  • 410
  • 3
  • 9
  • the issue has been merged with https://code.google.com/p/android/issues/detail?id=56843&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars – Adam Johns Jun 21 '13 at 20:57
2

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

ah008a
  • 1,115
  • 6
  • 11
  • someone from google commented in the bug thread and said the only real workaround right now is what csongor suggested – Adam Johns Jun 21 '13 at 21:21
0

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'

Golan Shay
  • 1,250
  • 18
  • 15
0

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

Amin
  • 1,034
  • 10
  • 17