I have imported an aar library to my project, included it in libs folder and added to gradle like following:
compile ('com.adclient.android.sdk:adclient-sdk-for-android-3.3.0@aar') {
transitive = true
}
The thing is that the aar cointains some dependencies inside that are also compiled in my project, and I get duplication errors. If I get the dependencies tree, the library looks empty:
+--- com.adclient.android.sdk:adclient-sdk-for-android-3.3.0:
Also, if I use exclude in the library compile statement, it has no effect. E.g:
compile ('com.adclient.android.sdk:adclient-sdk-for-android-3.3.0@aar') {
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
transitive = true
}
I can exclude duplicated dependencies within the other libraries, but I prefer to keep them in the new dependency addition. So, is it possible to exclude dependencies inside the aar? What I'm doing wrong?
Edit:
This is the type of error I'm getting. It's a warning but our ProGuard stops because of that:
Copying resources from program jar [/Users/adalpari/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.9.0/1b6c10b5120995a7542c1a31b7828fb8593c8ba/okhttp-3.9.0.jar] (filtered) Warning: Exception while processing task java.io.IOException: Can't write [/Users/adalpari/X/build/intermediates/transforms/proguard/production/release/jars/3/1f/main.jar] (Can't read [/Users/adalpari/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.9.0/1b6c10b5120995a7542c1a31b7828fb8593c8ba/okhttp-3.9.0.jar(;;;;;;**.class)] (Duplicate zip entry [okhttp3/a.class == okhttp-3.9.0.jar:okhttp3/Address.class])) :AndroidApp:transformClassesAndResourcesWithProguardForProductionRelease FAILED