I\'m trying the new Android Studio. I\'ve exported a project from eclipse, using the build gradle option. I\'ve then imported it in Android Studio. The R.java file under gen
Follow the five steps below:
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
)I have had the same problem but after all the steps it's work for me.
I solve that problem setting JAVA_HOME, CLASSPATH.
People sometimes skip JAVA_HOME and CLASSPATH when setting Java_path.
So try to check Environment Variable.
CLASSPATH -> .;
JAVA_HOME -> C:\Program Files\Java\jdk(version) or where Java installed
and then check the xml file which can have error(Do not naming well-known things such as button,text etc)
None of these answers helped me!
My problem was not a problem! The program could compile completely and run on the device but the IDE has given me an annoying syntax error. It has underlined the lines of codes that included "R.".
The way that I could solve this issue:
I just added these three classes in "myapp/gen/com.example.app/" folder:
BuildConfig
package com.example.app;
public final class BuildConfig {
public final static boolean DEBUG = true;
}
Manifest
package com.example.app;
public final class Manifest {
}
R
package com.example.app;
public final class R {
}
In my case, I found that "android.R.layout.account_list" was referenced instead of "R.layout.account_list". Simply remove "android." can fix the problem. Hope this help because sometimes you may overlook when you are too focusing.
You should check all your files if it don't have errors and again rebuild your project in:
Or in:
Check use external build
and after rebuild the project.
The solution posted by https://stackoverflow.com/users/1373278/hoss above worked for me. I am reproducing it here because I cannot yet comment on hoss' post:
Remove import android.R;
from your activity file in question.
My setup:
Android Studio 1.2.2
Exported project from one Mac to Git (everything was working). I then imported the project on another Mac from Git. Thats when it stopped resolving the resource files.
I tried everything on this thread:
Nothing worked except removing import android.R;
from my activity java file.
To avoid this issue in the future add .idea
folder to your .gitignore
file. There is a nice plugin from git for gitignore in Android Studio. Install this plugin and right click in .idea > Add to .gitignore