Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

设置了OkhttpClient,运行报找不到类的错误 #12

Open
Demidong opened this issue Aug 16, 2018 · 0 comments
Open

设置了OkhttpClient,运行报找不到类的错误 #12

Demidong opened this issue Aug 16, 2018 · 0 comments

Comments

@Demidong
Copy link

DTInstaller.install(application)
.setBlockCanary(AppBlockCanaryContext(application))
.setOkHttpClient(RetrofitManager.client)
.setInjector(ContentInjector())
.enable()
.run()
val client: OkHttpClient by lazy { createOkHttpClient() }

private fun createOkHttpClient(): OkHttpClient {
val httpLoggingInterceptor = HttpLoggingInterceptor()
httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.BODY

    return OkHttpClient.Builder()
            .addInterceptor(createTokenInterceptor())
            .addInterceptor(createBodyInterceptor())
            .addInterceptor(httpLoggingInterceptor)
            .connectTimeout(30L, TimeUnit.SECONDS)
            .readTimeout(30L, TimeUnit.SECONDS)
            .writeTimeout(30L, TimeUnit.SECONDS)
            .build()
}

08-16 15:09:57.377 28075-28075/com.xd.demi.todo I/art: Rejecting re-init on previously-failed class java.lang.Class<com.exyui.android.debugbottle.components.okhttp.LoggingInterceptor>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/okhttp/Interceptor;
at void com.exyui.android.debugbottle.components.DTInstaller.run() (DTInstaller.kt:218)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.squareup.okhttp.Interceptor" on path: DexPathList[[zip file "/data/app/com.xd.demi.todo-1/base.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.xd.demi.todo-1/lib/arm64, /data/app/com.xd.demi.todo-1/base.apk!/lib/arm
at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
at void com.exyui.android.debugbottle.components.DTInstaller.run() (DTInstaller.kt:218)
at void com.xd.demi.TDLApplication.initDeBugBottle() (TDLApplication.kt:64)
at void com.xd.demi.TDLApplication.onCreate() (TDLApplication.kt:47)
at void android.app.Instrumentation.callApplicationOnCreate(android.app.Application) (Instrumentation.java:1027)

我看了下是run方法中 调用了OkHttpLoader的load方法,load()中new了一个LoggingInterceptor(),这个是com.squareup.okhttp.Interceptor包里的 现在都是 com.squareup.okhttp3.Interceptor了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant