SDK conflict with HTTP apache

android

#1

Hello here,

When i wanted to implement Wonderpush into my app, i have got an issue :

Error: Program type already present: com.loopj.android.http.AsyncHttpResponseHandler$ResponderHandler

It seems that the org.apache.http.legacy lib is duplicated into my gradle file…
While org.apache.http.legacy is removed from the latest Android SDK, I’m using the
useLibrary 'org.apache.http.legacy' (imported sdk)

First option : I tryed to exlude libs from the sdk. However we can’t with imported file…
Second option : I tried with the WonderPush sdk :

implementation('com.wonderpush:wonderpush-android-sdk:1.2.7.2') {
   exclude group: 'com.loopj.android'
    ['http.AsyncHttpResponseHandler$ResponderHandler', 'http.BaseJsonHttpResponseHandler'].each {
        exclude module: "$it"
    }
}

And the result isn’t good :

Process: com.cogelec.notificationpush, PID: 7480
java.lang.NoClassDefFoundError: Failed resolution of: Lcz/msebera/android/httpclient/message/BasicNameValuePair;
    at com.wonderpush.sdk.WonderPushRestClient$Request.toJSON(WonderPushRestClient.java:613)
    at com.wonderpush.sdk.WonderPushRequestVault.put(WonderPushRequestVault.java:53)
    at com.wonderpush.sdk.WonderPushRestClient.postEventually(WonderPushRestClient.java:117)
   [...]
E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "cz.msebera.android.httpclient.message.BasicNameValuePair" on path: DexPathList[[zip file "/data/app/com.cogelec.notificationpush-lv_58g2-JkyfSdr7Gy-OnQ==/base.apk", zip file 
   [...]
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/com.cogelec.notificationpush-lv_58g2-JkyfSdr7Gy-OnQ==/split_lib_resources_apk.apk
    at dalvik.system.DexFile.openDexFileNative(Native Method)
    at dalvik.system.DexFile.openDexFile(DexFile.java:353)
   [...]

Any idea ?

Thank you in advance


#2

Hello,

Can you post the output of

./gradlew app:dependencies --configuration releaseCompileClasspath

and

./gradlew app:dependencyInsight --configuration releaseCompileClasspath --dependency org.apache.http.legacy

and your ./build.gradle and app/build.gradle.

It may be a version mismatch between multiple modules of modular dependencies com.android.support:support-v4, com.android.support:appcompat-v7 or com.google.android.gms:play-services-gcm.

Which of your dependencies is adding org.apache.http.legacy?
Can you work your way to avoid it being added altogether?
Note that with Android 9 you might run into new sorts of problems if using it.

Best,


#3
./gradlew app:dependencies --configuration releaseCompileClasspath

+--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.11
|    \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.11
|         +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.11
|         \--- org.jetbrains:annotations:13.0 -> 16.0.1
+--- androidx.browser:browser:1.0.0
|    +--- androidx.core:core:1.0.0 -> 1.1.0-alpha02
|    |    +--- com.google.guava:listenablefuture:1.0
|    |    +--- androidx.annotation:annotation:1.0.1
|    |    +--- androidx.collection:collection:1.0.0 -> 1.1.0-alpha01
|    |    |    \--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0
|    |    |    +--- androidx.lifecycle:lifecycle-common:2.0.0
|    |    |    |    \--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|    |    |    \--- androidx.arch.core:core-common:2.0.0
|    |    |         \--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|    |    +--- androidx.versionedparcelable:versionedparcelable:1.1.0-alpha01
|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|    |    |    \--- androidx.collection:collection:1.0.0 -> 1.1.0-alpha01 (*)
|    |    \--- androidx.concurrent:concurrent-futures:1.0.0-alpha02
|    |         +--- com.google.guava:listenablefuture:1.0
|    |         \--- androidx.annotation:annotation:1.0.0-rc01 -> 1.0.1
|    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|    +--- androidx.interpolator:interpolator:1.0.0
|    |    \--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|    +--- androidx.collection:collection:1.0.0 -> 1.1.0-alpha01 (*)
|    \--- androidx.legacy:legacy-support-core-ui:1.0.0
|         +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         +--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|         +--- androidx.legacy:legacy-support-core-utils:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         |    +--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|         |    +--- androidx.documentfile:documentfile:1.0.0
|         |    |    \--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         |    +--- androidx.loader:loader:1.0.0
|         |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         |    |    +--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|         |    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0
|         |    |    |    +--- androidx.arch.core:core-runtime:2.0.0
|         |    |    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         |    |    |    |    \--- androidx.arch.core:core-common:2.0.0 (*)
|         |    |    |    +--- androidx.lifecycle:lifecycle-livedata-core:2.0.0
|         |    |    |    |    +--- androidx.lifecycle:lifecycle-common:2.0.0 (*)
|         |    |    |    |    +--- androidx.arch.core:core-common:2.0.0 (*)
|         |    |    |    |    \--- androidx.arch.core:core-runtime:2.0.0 (*)
|         |    |    |    \--- androidx.arch.core:core-common:2.0.0 (*)
|         |    |    \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0
|         |    |         \--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         |    +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
|         |    |    \--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         |    \--- androidx.print:print:1.0.0
|         |         \--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         +--- androidx.customview:customview:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         |    \--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|         +--- androidx.viewpager:viewpager:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         |    +--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|         |    \--- androidx.customview:customview:1.0.0 (*)
|         +--- androidx.coordinatorlayout:coordinatorlayout:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         |    +--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|         |    \--- androidx.customview:customview:1.0.0 (*)
|         +--- androidx.drawerlayout:drawerlayout:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         |    +--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|         |    \--- androidx.customview:customview:1.0.0 (*)
|         +--- androidx.slidingpanelayout:slidingpanelayout:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         |    +--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|         |    \--- androidx.customview:customview:1.0.0 (*)
|         +--- androidx.interpolator:interpolator:1.0.0 (*)
|         +--- androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         |    +--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|         |    \--- androidx.interpolator:interpolator:1.0.0 (*)
|         +--- androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         |    \--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|         \--- androidx.cursoradapter:cursoradapter:1.0.0
|              \--- androidx.annotation:annotation:1.0.0 -> 1.0.1
+--- androidx.legacy:legacy-support-v4:1.0.0
|    +--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|    +--- androidx.media:media:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|    |    +--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|    |    \--- androidx.versionedparcelable:versionedparcelable:1.0.0 -> 1.1.0-alpha01 (*)
|    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
|    +--- androidx.legacy:legacy-support-core-ui:1.0.0 (*)
|    \--- androidx.fragment:fragment:1.0.0 -> 1.1.0-alpha02
|         +--- androidx.core:core:1.1.0-alpha01 -> 1.1.0-alpha02 (*)
|         +--- androidx.viewpager:viewpager:1.0.0 (*)
|         +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         +--- androidx.loader:loader:1.0.0 (*)
|         +--- androidx.activity:activity:1.0.0-alpha02
|         |    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|         |    +--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|         |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 (*)
|         |    \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 (*)
|         \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 (*)
+--- androidx.appcompat:appcompat:1.1.0-alpha01
|    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|    +--- androidx.core:core:1.1.0-alpha01 -> 1.1.0-alpha02 (*)
|    +--- androidx.collection:collection:1.1.0-alpha01 (*)
|    +--- androidx.cursoradapter:cursoradapter:1.0.0 (*)
|    +--- androidx.fragment:fragment:1.1.0-alpha02 (*)
|    +--- androidx.vectordrawable:vectordrawable:1.0.1
|    |    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|    |    \--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|    +--- androidx.vectordrawable:vectordrawable-animated:1.0.0
|    |    +--- androidx.vectordrawable:vectordrawable:1.0.0 -> 1.0.1 (*)
|    |    \--- androidx.legacy:legacy-support-core-ui:1.0.0 (*)
|    \--- androidx.drawerlayout:drawerlayout:1.0.0 (*)
+--- androidx.recyclerview:recyclerview:1.1.0-alpha01
|    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|    +--- androidx.core:core:1.1.0-alpha02 (*)
|    \--- androidx.customview:customview:1.0.0 (*)
+--- androidx.legacy:legacy-support-core-ui:1.0.0 (*)
+--- androidx.constraintlayout:constraintlayout:2.0.0-alpha3
|    +--- androidx.appcompat:appcompat:1.0.0-rc01 -> 1.1.0-alpha01 (*)
|    +--- androidx.recyclerview:recyclerview:1.0.0-rc01 -> 1.1.0-alpha01 (*)
|    \--- androidx.constraintlayout:constraintlayout-solver:2.0.0-alpha3
+--- androidx.multidex:multidex:2.0.1
+--- com.google.android.material:material:1.1.0-alpha02
|    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|    +--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|    +--- androidx.legacy:legacy-support-core-ui:1.0.0 (*)
|    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
|    +--- androidx.fragment:fragment:1.0.0 -> 1.1.0-alpha02 (*)
|    +--- androidx.transition:transition:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|    |    \--- androidx.core:core:1.0.0 -> 1.1.0-alpha02 (*)
|    +--- androidx.appcompat:appcompat:1.0.0 -> 1.1.0-alpha01 (*)
|    +--- androidx.cardview:cardview:1.0.0
|    |    \--- androidx.annotation:annotation:1.0.0 -> 1.0.1
|    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.1.0-alpha01 (*)
+--- com.google.firebase:firebase-messaging:17.3.4
|    +--- com.google.android.gms:play-services-basement:16.0.1
|    |    \--- androidx.legacy:legacy-support-v4:1.0.0-rc01 -> 1.0.0 (*)
|    +--- com.google.android.gms:play-services-tasks:16.0.1
|    |    \--- com.google.android.gms:play-services-basement:16.0.1 (*)
|    +--- com.google.firebase:firebase-common:16.0.3
|    |    +--- com.google.android.gms:play-services-basement:16.0.1 (*)
|    |    \--- com.google.android.gms:play-services-tasks:16.0.1 (*)
|    +--- com.google.firebase:firebase-iid:[17.0.4] -> 17.0.4
|    |    +--- com.google.android.gms:play-services-basement:16.0.1 (*)
|    |    +--- com.google.android.gms:play-services-stats:16.0.1
|    |    |    \--- com.google.android.gms:play-services-basement:16.0.1 (*)
|    |    +--- com.google.android.gms:play-services-tasks:16.0.1 (*)
|    |    +--- com.google.firebase:firebase-common:16.0.3 (*)
|    |    \--- com.google.firebase:firebase-iid-interop:16.0.1
|    |         +--- com.google.android.gms:play-services-base:16.0.1
|    |         |    +--- com.google.android.gms:play-services-basement:16.0.1 (*)
|    |         |    \--- com.google.android.gms:play-services-tasks:16.0.1 (*)
|    |         \--- com.google.android.gms:play-services-basement:16.0.1 (*)
|    \--- com.google.firebase:firebase-measurement-connector:17.0.1
|         \--- com.google.android.gms:play-services-basement:16.0.1 (*)
+--- com.google.firebase:firebase-core:16.0.6
|    +--- com.google.firebase:firebase-analytics:16.0.6
|    |    +--- com.google.android.gms:play-services-basement:16.0.1 (*)
|    |    +--- com.google.android.gms:play-services-measurement-api:[16.0.4] -> 16.0.4
|    |    |    +--- com.google.android.gms:play-services-ads-identifier:16.0.0
|    |    |    |    \--- com.google.android.gms:play-services-basement:16.0.1 (*)
|    |    |    +--- com.google.android.gms:play-services-basement:16.0.1 (*)
|    |    |    +--- com.google.android.gms:play-services-measurement-base:[16.0.5] -> 16.0.5
|    |    |    |    \--- com.google.android.gms:play-services-basement:16.0.1 (*)
|    |    |    +--- com.google.android.gms:play-services-stats:16.0.1 (*)
|    |    |    +--- com.google.android.gms:play-services-tasks:16.0.1 (*)
|    |    |    +--- com.google.firebase:firebase-analytics-impl:[16.2.4] -> 16.2.4
|    |    |    |    +--- com.google.android.gms:play-services-ads-identifier:16.0.0 (*)
|    |    |    |    +--- com.google.android.gms:play-services-basement:16.0.1 (*)
|    |    |    |    +--- com.google.android.gms:play-services-measurement-base:[16.0.5] -> 16.0.5 (*)
|    |    |    |    +--- com.google.android.gms:play-services-stats:16.0.1 (*)
|    |    |    |    +--- com.google.android.gms:play-services-tasks:16.0.1 (*)
|    |    |    |    +--- com.google.firebase:firebase-common:16.0.3 (*)
|    |    |    |    \--- com.google.firebase:firebase-iid:17.0.3 -> 17.0.4 (*)
|    |    |    +--- com.google.firebase:firebase-common:16.0.3 (*)
|    |    |    \--- com.google.firebase:firebase-iid:17.0.3 -> 17.0.4 (*)
|    |    +--- com.google.android.gms:play-services-measurement-base:[16.0.5] -> 16.0.5 (*)
|    |    +--- com.google.android.gms:play-services-stats:16.0.1 (*)
|    |    +--- com.google.firebase:firebase-analytics-impl:[16.2.4] -> 16.2.4 (*)
|    |    \--- com.google.firebase:firebase-common:16.0.3 (*)
|    \--- com.google.firebase:firebase-measurement-connector-impl:17.0.4
|         +--- com.google.android.gms:play-services-basement:16.0.1 (*)
|         +--- com.google.android.gms:play-services-measurement-api:[16.0.4] -> 16.0.4 (*)
|         +--- com.google.android.gms:play-services-measurement-base:[16.0.5] -> 16.0.5 (*)
|         +--- com.google.firebase:firebase-analytics:[16.0.6] -> 16.0.6 (*)
|         +--- com.google.firebase:firebase-analytics-impl:[16.2.4] -> 16.2.4 (*)
|         +--- com.google.firebase:firebase-common:16.0.3 (*)
|         \--- com.google.firebase:firebase-measurement-connector:17.0.1 (*)
+--- com.crashlytics.sdk.android:crashlytics:2.9.8
|    +--- com.crashlytics.sdk.android:beta:1.2.10
|    +--- io.fabric.sdk.android:fabric:1.4.7
|    +--- com.crashlytics.sdk.android:crashlytics-core:2.6.7
|    |    +--- io.fabric.sdk.android:fabric:1.4.7
|    |    \--- com.crashlytics.sdk.android:answers:1.4.6
|    |         \--- io.fabric.sdk.android:fabric:1.4.7
|    \--- com.crashlytics.sdk.android:answers:1.4.6 (*)
+--- com.onesignal:OneSignal:3.10.2
|    +--- com.google.firebase:firebase-messaging:[10.2.1, 12.1.0) -> 17.3.4 (*)
|    +--- com.google.android.gms:play-services-location:[10.2.1, 12.1.0) -> 15.0.1
|    |    +--- com.google.android.gms:play-services-base:[15.0.1,16.0.0) -> 16.0.1 (*)
|    |    +--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 16.0.1 (*)
|    |    +--- com.google.android.gms:play-services-places-placereport:[15.0.1,16.0.0) -> 15.0.1
|    |    |    \--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 16.0.1 (*)
|    |    \--- com.google.android.gms:play-services-tasks:[15.0.1,16.0.0) -> 16.0.1 (*)
|    +--- com.google.android.gms:play-services-base:[10.2.1, 12.1.0) -> 16.0.1 (*)
|    +--- androidx.legacy:legacy-support-v4:1.0.0-rc01 -> 1.0.0 (*)
|    \--- androidx.browser:browser:1.0.0-rc01 -> 1.0.0 (*)
+--- com.wonderpush:wonderpush-android-sdk:1.2.7.2
|    +--- com.google.android.gms:play-services-gcm:11.0.4 -> 15.0.1
|    |    +--- com.google.android.gms:play-services-base:[15.0.1,16.0.0) -> 16.0.1 (*)
|    |    +--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 16.0.1 (*)
|    |    +--- com.google.android.gms:play-services-iid:[15.0.1] -> 15.0.1
|    |    |    +--- com.google.android.gms:play-services-base:[15.0.1,16.0.0) -> 16.0.1 (*)
|    |    |    +--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 16.0.1 (*)
|    |    |    +--- com.google.android.gms:play-services-stats:[15.0.1,16.0.0) -> 16.0.1 (*)
|    |    |    \--- com.google.android.gms:play-services-tasks:[15.0.1,16.0.0) -> 16.0.1 (*)
|    |    \--- com.google.android.gms:play-services-stats:[15.0.1,16.0.0) -> 16.0.1 (*)
|    \--- androidx.legacy:legacy-support-v4:1.0.0-rc01 -> 1.0.0 (*)
+--- org.linphone:linphone-sdk-android:4.1-160-g7a9af0d
|    +--- org.apache.commons:commons-compress:1.16.1
|    |    \--- org.objenesis:objenesis:2.6
|    \--- androidx.multidex:multidex:2.0.0 -> 2.0.1
+--- com.romandanylyk:pageindicatorview:1.0.2
+--- com.squareup.retrofit2:retrofit:2.5.0
|    \--- com.squareup.okhttp3:okhttp:3.12.0
|         \--- com.squareup.okio:okio:1.15.0
+--- com.squareup.retrofit2:converter-jackson:2.4.0
|    +--- com.squareup.retrofit2:retrofit:2.4.0 -> 2.5.0 (*)
|    \--- com.fasterxml.jackson.core:jackson-databind:2.9.4 -> 2.9.7
|         +--- com.fasterxml.jackson.core:jackson-annotations:2.9.0 -> 2.9.7
|         \--- com.fasterxml.jackson.core:jackson-core:2.9.7
+--- com.squareup.retrofit2:adapter-rxjava2:2.4.0
|    +--- com.squareup.retrofit2:retrofit:2.4.0 -> 2.5.0 (*)
|    \--- io.reactivex.rxjava2:rxjava:2.0.0
|         \--- org.reactivestreams:reactive-streams:1.0.0
+--- com.fasterxml.jackson.core:jackson-core:2.9.7
+--- com.fasterxml.jackson.core:jackson-databind:2.9.7 (*)
+--- com.fasterxml.jackson.core:jackson-annotations:2.9.7
+--- com.github.Cutta:GifView:1.1
+--- it.sephiroth.android.library.bottomnavigation:bottom-navigation:3.0.0
|    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.10
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.10 -> 1.3.11 (*)
|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.10 -> 1.3.11 (*)
|    +--- androidx.appcompat:appcompat:1.0.2 -> 1.1.0-alpha01 (*)
|    +--- com.google.android.material:material:1.1.0-alpha01 -> 1.1.0-alpha02 (*)
|    +--- com.readystatesoftware.systembartint:systembartint:1.0.4
|    +--- com.jakewharton.timber:timber:4.7.1
|    |    \--- org.jetbrains:annotations:16.0.1
|    \--- com.balysv:material-ripple:1.0.2
+--- com.jakewharton.timber:timber:4.7.1 (*)
\--- androidx.multidex:multidex:2.0.0 -> 2.0.1
./gradlew app:dependencyInsight --configuration releaseCompileClasspath --dependency org.apache.http.legacy

Assuming max safe default of '28.+' for 'com.android.support'
No dependencies matching given input were found in configuration ':app:releaseCompileClasspath'

Yes, I already been in touch with these news. The Android 9 update force me to import the org.apache.http.legacy in an other way…

in manifest file, i use :

<uses-library android:name="org.apache.http.legacy" android:required="false"/>

and in gradle :

useLibrary 'org.apache.http.legacy'

Here is my both build gradle :

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.11.3'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

repositories {
    maven { url 'https://maven.google.com' }
    maven {
        // Switch to release for releases !
        url "https://gitlab.linphone.org/BC/public/maven_repository/raw/master"
    }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "XXXXXXXXXXXXXX"
        minSdkVersion 16
        targetSdkVersion 28
        multiDexEnabled true
        versionCode 201
        versionName "2.0.1"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        manifestPlaceholders = [
                onesignal_app_id               : 'XXXXXXXXXXXXXXXXXXXXXX',
                // Project number pulled from dashboard, local value is ignored.
                onesignal_google_project_number: 'REMOTE',
                wonderpushDefaultActivity      : 'XXXXXXXX.ui.activities.MenuManagerActivity',
                wonderpushNotificationIcon     : '@drawable/ico'
        ]
        useLibrary 'org.apache.http.legacy'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.browser:browser:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
    implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha01'
    implementation 'androidx.legacy:legacy-support-core-ui:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.google.android.material:material:1.1.0-alpha02'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    /** firebase */
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
    /** push notif */
    implementation 'com.onesignal:OneSignal:3.10.2'
    implementation('com.wonderpush:wonderpush-android-sdk:1.2.7.2') {
       exclude group: 'com.loopj.android'
        ['http.AsyncHttpResponseHandler$ResponderHandler', 'http.BaseJsonHttpResponseHandler'].each {
            exclude module: "$it"
        }
    }
    /** liblinphone */
    /*releaseImplementation 'org.linphone:liblinphone-sdk:4.1-160-g7a9af0d'
    debugImplementation 'org.linphone:liblinphone-sdk:4.0.1-DEBUG'*/
    implementation "org.linphone:linphone-sdk-android:4.1-160-g7a9af0d"
    /** page indicator */
    implementation 'com.romandanylyk:pageindicatorview:1.0.2'
    /** retrofit2 */
    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.retrofit2:converter-jackson:2.4.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
    /**  jackson */
    implementation 'com.fasterxml.jackson.core:jackson-core:2.9.7'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.7'
    implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.7'
    /** GifView */
    implementation 'com.github.Cutta:GifView:1.1'
    /** Bottom Navigation View */
    implementation 'it.sephiroth.android.library.bottomnavigation:bottom-navigation:3.0.0'
    /** Timber */
    implementation 'com.jakewharton.timber:timber:4.7.1'
}

#4

It looks like one of your dependencies is defining code in com.loopj.android.http.

I see that you’re using the OneSignal SDK in your application. It’s a bad idea to have multiple actors trying to handle push notifications and we do not support this.

If after removing OneSignal you still have the com.loopj.android.http declared by another dependency of yours, you will have to check them one by one in turn as they should not put classes in packages other than their own as it clashes when all the AAR (JARs) are merged together.

Best,


#5

When i removed the OneSignal SDK, the problem persists.

I thinked the problem occured because of useLibrary 'org.apache.http.legacy' but it only implents the Header and StringEntity objects and seems to not perturbs wonderpush.

I found the source of the problem later from a lib that i included with the fileTree named “android-async-http-1.4.6”
When I removed it, i coundn’t use my web services, but the wonderpush SDK count my registration.

Thank you for your time, i will find an alternative way to use my web services.