Closed eliotstock closed 5 years ago
I'm not involved in developing the DFU library but I find it odd that you have set targetSdkVersion to the same value as minSdkVersion but have set a higher compileSdkVersion (https://medium.com/androiddevelopers/picking-your-compilesdkversion-minsdkversion-targetsdkversion-a098a0341ebd).
Also make sure that you are using at least version 3.1.0 of the Android Gradle Plugin (see: https://developer.android.com/studio/releases/gradle-plugin)
Hi @eliotstock, No, the DFU lib is not dependent on BLE library. It's much older, I'd have to rewrite everything. I would say that the issue is related to importing multiple versions of support library. DFU uses support-core-utils:28.0.0 and your google services may use different. You may run gradle task: help:dependencies for your app module. It will list all dependencies:
archives - Configuration for archive artifacts.
+--- com.android.support:support-core-utils:28.0.0
| +--- com.android.support:support-annotations:28.0.0
| +--- com.android.support:support-compat:28.0.0
| | +--- com.android.support:support-annotations:28.0.0
| | +--- com.android.support:collections:28.0.0
| | | \--- com.android.support:support-annotations:28.0.0
| | +--- android.arch.lifecycle:runtime:1.1.1
| | | +--- android.arch.lifecycle:common:1.1.1
| | | | \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
| | | +--- android.arch.core:common:1.1.1
| | | | \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
[...]
All should finally use the same version, as above. lifecycleruntime uses annotations:26.1.0, but they are switched to 28.0.0. If you find any older without ->, then add it explicitly to your dependencies. I'm doing it here: https://github.com/NordicSemiconductor/Android-nRF-Toolbox/blob/develop/wear/build.gradle#L44. Try adding android-support-v4:28.0.0
.
Gradle version should not matter.
OK, thanks. I tried adding this:
implementation 'com.android.support:support-v4:28.0.0'
But got this error in the gradle lint even before building:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 27.1.1. Examples include com.android.support:collections:28.0.0 and com.android.support:animated-vector-drawable:27.1.
It's Firebase and com.google.android.gms:play-services-location
that are pulling in 28.0.0.
Just add more dependencies:
implementation 'com.android.support:collections:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
etc.
Oh I see, thanks. That's fixed it. My full list in the end is:
implementation 'no.nordicsemi.android:dfu:1.8.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:collections:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
i have added all the dependencies in my build gradle but I am getting the same error
Did you follow this comment: https://github.com/NordicSemiconductor/Android-DFU-Library/issues/147#issuecomment-437799520
In moving from v1.7.0 to v1.8.0, I get this error not at build time, but when first running/debugging the app in Android Studio:
Here's my app gradle file:
I noticed you bumped your gradle version in 1.8.0, so I changed mine to match yours (4.10.2) but that didn't help. Can you see anything wrong here? Is there a new dependency between the bLE library and the DFU library or vice versa?