I am unable to build my project in Android Studio. I get the following error:
Error:Android Dex: [RaditazAndroid] Unable to execute DX
Error:Android Dex: [R
In case someone else was having this problem with the Project Tango examples provided via Github, I solved it by commenting the following line out in the app's build.gradle
file for those projects which failed to run:
compile fileTree(dir: external_lib_prefix + '/jar', include: ['**/*.jar'])
I had the same error.Solved it by adding to gradle file.
dependencies{
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
}
In case you have:
compile 'com.android.support:recyclerview-v7:24.2.0'
compile('com.android.support:appcompat-v7:23.2.0') { exclude group: 'com.google.android', module: 'support-v4' }
in your project, add also:
compile 'com.android.support:support-v4:24.2.0'
or
compile 'com.android.support:design:24.2.0'
I had same issue in Android Studio 2.3, in my case I had a mixture of version numbers which threw the build out, I changed:
dependencies {
compile 'com.google.android.gms:play-services-wearable:7.5.0'
compile 'com.google.android.gms:play-services-analytics:7.5.0'
compile 'com.google.android.gms:play-services-drive:8.4.0'
}
to
dependencies {
compile 'com.google.android.gms:play-services-wearable:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-drive:8.4.0'
}
I used a different approach by merging ABS res folder with my res folder and using ActionBarSherlock.jar as a global lib.
Works well so far and hope this help someone! But this is a hack since I was fed up of doing many things and I can't use Gradle since some of the other developers using Eclipse ADT without Gradle.
Root Cause for the issue is using android-support-v4 in ABS and my project both and it's complicating DEX.