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 my case the problem was in module sdk version. I changed it from 2.2 to 4.4 and the problem was solved.
Away from Android Studio, I opened the project in finder/workspace and did this:
1- MyProject folder -> build -> intermediate -> dex-cache -> cache.xml, and deleted all support-v4.jar items.
2- Also away from Android Studio, Went to every module in my project -> lib folder -> and deleted support-v4.jar as well.
Then cleaned the project and ran it and it worked thanks god :)
For anyone who is interested, I solved my own problem. My mistake was that I had pasted android-support-v4.jar and google-play-services.jar in all of my project's module lib folders (my project consists of 3 modules). What I had to do instead was to paste these jars only into my main module's lib folder, and the other modules would automatically reference them.
For others wondering why this problem still persist even doing all other things suggested, This may help.
For me problem started when i added Glide library
dependencies {
.........
implementation 'com.github.bumptech.glide:glide:4.8.0'
.........
}
and i had added already.
implementation 'com.android.support:design:26.1.0'
Which was contradicting with Glide support library somewhere.
Solution: Remove or downgrade your Glide support version.
implementation 'com.github.bumptech.glide:glide:4.0.0'
Clean and rebuild was all it took for mine to start working.
I had the same error.
Removing a library(jtwitter.jar) form my-project/app/libs folder helped me.
Then cleaned the project and ran it and it worked.