So, I am getting the following error while running the project after upgrading build.gradle (Project) from
dependencies {
classpath \'com.android.too
This problem is mainly in gradle or in misversioned libraries, including, from libraries, when both define the same class. Expand and check, imported external libraries...
You cannot have two same classes to be exported to one place, or code, therefore, dexer does not know which one should be used...
My project used an external library with heterogeneous Java compatibility versions in my build.gradle
files (1.7 and 1.8).
I fixed it by using the same version for the lib and for the app project. In my case for both :
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
If you have multiple projects, make sure you are not adding a dependency multiple times, I needed to exclude the other project's dependency like this:
compile(project(':OtherProject-SDK')) {
compile.exclude module: 'play-services-gcm'
compile.exclude module: 'play-services-location'
compile.exclude module: 'support-v4'
compile.exclude module: 'okhttp'
}
In my case the problem was because of capital letters in some packages.
In my case, this was due to my library not being configured as 'android'.
E.g. apply plugin:'java'
instead of apply plugin:'com.android.library'
I found in my case, this issue was caused by an improper configuration of build.gradle. I had two different versions of com.google.firebase. Once the versions were the same, the issue was solved