I have Android Studio Beta. I created a new project with compile my old modules but when I tried launching the app it did not launch with the message:
Error:
In case the top answers haven't worked for you, your issue may be that you have multiple dependencies that depend on the same library.
Here are some debugging tips. In this sample code, com.google.code.findbugs:jsr305:3.0.0
is the offending library.
Always clean and rebuild every time you modify to check your solution!
Build with the --stacktrace
flag on for more detail. It will complain about a class, Google that class to find the library. Here's how you can set up Android studio to always run gradle with the --stacktrace flag.
Take a glance at the Gradle Console in Android Studio View > Tool Windows > Gradle Console
after a build
Check for repeated dependences by running ./gradlew -q app:dependencies
. You can re-run this each time you modify the your build.gradle.
In build.gradle,
android {
...
configurations.all {
resolutionStrategy {
// Force a particular version of the library
// across all dependencies that have that dependency
force 'com.google.code.findbugs:jsr305:3.0.0'
}
}
}
In build.gradle,
dependencies {
...
implementation('com.google.auth:google-auth-library-oauth2-http:0.6.0') {
// Exclude the library for this particular import
exclude group: 'com.google.code.findbugs'
}
}
In build.gradle,
android {
...
configurations.all {
resolutionStrategy {
// Completely exclude the library. Works for transitive
// dependencies.
exclude group: 'com.google.code.findbugs'
}
}
}
If some of your dependencies are in jar files, open up the jar files and see if there are any conflicting class names. If they are, you will probably have to re-build the jars with new class names or look into shading.
Some more background reading: