Tag: 拦截器

java.lang.NoClassDefFoundError:com.example.api.retrofit.AuthenticationInterceptor $ intercept $ 1

我最近添加了retrofit2到我的应用程序。 它在运行Android 8.0的Nexus 6P上运行良好,但是在运行Android 6.0.1的旧版OnePlus One上运行时遇到了一个错误: java.lang.NoClassDefFoundError: com.example.api.retrofit.AuthenticationInterceptor$intercept$1 at com.example.api.retrofit.AuthenticationInterceptor.intercept(AuthenticationInterceptor.kt:21) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185) at okhttp3.RealCall.execute(RealCall.java:69) at retrofit2.OkHttpCall.execute(OkHttpCall.java:180) at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall.execute(ExecutorCallAdapterFactory.java:91) at com.example.fragment.xx.XXFragment$onViewCreated$2.getItemsForConstraint(XXFragment.kt:53) at com.example.view.MyAutoCompleteTextView$Adapter$getFilter$1.performFiltering(MyAutoCompleteTextView.kt:114) at android.widget.Filter$RequestHandler.handleMessage(Filter.java:234) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.os.HandlerThread.run(HandlerThread.java:61) 这是我的代码: 的build.gradle buildscript { ext { okhttpVersion = '3.8.0' retrofitVersion = '2.3.0' } … } 应用程序/的build.gradle: compile "com.squareup.okhttp3:okhttp:$okhttpVersion" compile "com.squareup.okhttp3:logging-interceptor:$okhttpVersion" compile […]