Reputation: 28519
I'm stumped by this build error. It appears it may be related to using AppCompat, as if I remove that dependency from the build file the build error is no longer present. I am not using product flavors, and actually this project is very simple indeed - one Android module, a few classes and some resources. I'm using the Android Studio beta, 0.89 (latest).
I searched the source tree and can see two files called R.java, one in the app namespace the other in the AppCompat namespace.
Related is a second build error: "duplicate class: com.myapp.BuildConfig.java
Searching reveals only one file with that name in the project.
What does this build error mean, and how do I fix it?
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.myapp"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.0.0'
}
Upvotes: 2
Views: 2910
Reputation: 43
I would try deleting your R.java file, and then rebuilding the project.
If that doesn't work, try doing this.
- Delete the "gen", "target" and "out" folders
- Revert the changes within the "ipr" and "iml" files (or just delete them all, maybe even .idea folder)
- Start IntelliJ 12
- Open the pom file
- Right click -> "Maven" -> "Reimport"
- "Build" -> "Rebuild project"
Upvotes: 1