Closed jdevnano closed 6 years ago
You can try
configurations.all {
resolutionStrategy.force "com.google.code.findbugs:jsr305:3.0.2"
}
@Zhuinden Still the same error; I placed it in my app level gradle
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
configurations.all {
resolutionStrategy.force "com.google.code.findbugs:jsr305:3.0.2"
}
...
Judging from your gradle file com.google.code.findbugs:jsr305:3.0.2
is only included once, so no conflict should be possible. This leaves a couple of options:
1) It's a bug in the build system. Try to do a full clean and rebuild 2) Some of your other dependencies inlined the JSR305 dependency. This is extremely bad practice for exactly the reason you are seeing now, and should be fixed in that library. If this is not possible you can try to prevent Realm from including it. Right now we include it through our gradle plugin which makes things a little more tricky as you would manually need to duplicate the logic the plugin is doing (Add relevant dependencies + apply the Transformer).
I managed to figure out how to fix this issue. Thanks, @Zhuinden and @cmelchior! I used your suggestions as a starting point and found the new Gradle equivalent configs.
Instead of using
configurations.all {
...
}
the new gradle in AS 3.0 requires you to use their Variant API. For more, see here.
What worked for me:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
applicationVariants.all { variant ->
variant.getRuntimeConfiguration().exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
...
I recently updated to Android 3.0, which forced an update to the project's gradle. We also had to upgrade our target SDK to 26 and support libraries. I keep encountering a DexException and unable to build.
Thanks in advance!
Actual Results
Steps & Code to Reproduce
I used gradle to get a copy of our dependency tree. I tracked down javax.annotations library to com.google.code.findbugs:jsr305:3.0.2.
I also updated the project proguard with
Project level build.gradle
Library level build.gradle
App level build.gradle
Version of Realm and tooling
Realm version(s): 4.0.0
Realm sync feature enabled: no
Android Studio version: 3.0
Target SDK: 26