Application is working fine on all OS, but when i add facebook SDK, it gives me following error message on lollipop devices.
compile 'com.facebook.android:facebook-android-sdk:4.20.0'
Caused by: java.lang.ClassNotFoundException: Didn't find class "retrofit2.Retrofit$Builder" on path: DexPathList[[zip file "/data/app/com.myapp.app-3/base.apk", zip file
java.lang.NoClassDefFoundError: Failed resolution of: Lretrofit2/Retrofit$Builder; Caused by: java.lang.ClassNotFoundException: Didn't find class "retrofit2.Retrofit$Builder" on path: DexPathList[[zip file "/data/app/com.myapp.app-3/base.apk", zip file "/data/app/ com.myapp.app-3/split_lib_dependencies_apk.apk",
This is my gradle file.
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId 'com.myapp.app'
minSdkVersion 21
targetSdkVersion 23
versionCode 122
versionName "1.2.5"
multiDexEnabled true
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86"
}
configurations.all {
resolutionStrategy {
force 'com.squareup.okhttp:okhttp:2.4.0'
force 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
force 'com.squareup.okio:okio:1.11.0'
force 'com.squareup.okhttp3:okhttp:3.6.0'
force 'com.squareup.retrofit2:retrofit:2.2.0'
force 'com.android.support:recyclerview-v7:25.0.0'
force 'com.android.support:support-v4:25.0.0'
force 'com.android.support:cardview-v7:25.0.0'
force 'com.android.support:appcompat-v7:25.0.0'
force 'com.android.support:design:25.0.0'
force 'com.android.support:support-annotations:25.0.0'
force 'com.google.android.gms:play-services-ads:9.0.1'
force 'com.google.android.gms:play-services-location:9.0.1'
force 'com.google.android.gms:play-services-auth-base:9.0.1'
force 'com.google.android.gms:play-services-base:9.0.1'
}
configurations.all {
resolutionStrategy {
failOnVersionConflict()
}
}
Kindly guide me what can be the reason of this crash, and why its only crashing on lollipop devices and working fine on Marshmallow and Nougat.
EDIT
If I don't use facebook sdk, everything seems fine, no crashes. Maybe Facebook sdk cause this problem but I don't know why