2017-10-16 66 views
0

我有這樣的依存關係:

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" 
} 

和我的項目的建設始終與下面的錯誤整理:

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)

我猜想其中的一些庫是不兼容的。但如何解決這個問題?

+0

你編譯使用ProGuard? – WoogieNoogie

+0

爲'3.8.0'同樣的問題? –

+0

@WoogieNoogie,是的,我能夠通過'minifyEnabled TRUE' – Ksenia

回答

1

問題是,我用multiDexEnabled true,但之後我包括這依賴,並從

App extends Application 

改變我的代碼

App extends MultiDexApplication 

我沒有將

compile 'com.android.support:multidex:1.0.2' 

問題就消失了。