Reputation: 3753
I have such dependencies:
dependencies {
...
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.9.0'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.9.0'
compile 'io.reactivex.rxjava2:rxjava:2.1.0'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile "net.sourceforge.streamsupport:streamsupport:1.5.1"
}
and building of my project is always finishing with the following error:
FATAL EXCEPTION: main Process: com.icard.rest, PID: 13758 java.lang.NoClassDefFoundError: okhttp3.logging.HttpLoggingInterceptor$Logger at okhttp3.logging.HttpLoggingInterceptor.(HttpLoggingInterceptor.java:116) at com.comp.model.App.onCreate(App.java:30) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4464) at android.app.ActivityThread.access$1500(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1306) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:212) at android.app.ActivityThread.main(ActivityThread.java:5137) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:718) at dalvik.system.NativeStart.main(Native Method)
I suppose that some of these libraries are incompatible. But how to fix this?
Upvotes: 0
Views: 1614
Reputation: 3753
The problem was that I used multiDexEnabled true
, but I haven't included
compile 'com.android.support:multidex:1.0.2'
After I included this dependency and change my code from
App extends Application
to
App extends MultiDexApplication
the problem disappeared.
Upvotes: 1