我的应用使用rxjav,retrofit2,okhttp。今天它崩溃了:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String)' on a null object reference
at com.android.tools.profiler.support.network.okhttp.reflection.okhttp3.Request$.getTargetClass(Request$.java:29)
at com.android.tools.profiler.support.network.okhttp.reflection.okhttp3.Interceptor$$Chain$.proceed(Interceptor$.java:50)
at com.android.tools.profiler.support.network.okhttp.OkHttp3Interceptor.invoke(OkHttp3Interceptor.java:57)
at java.lang.reflect.Proxy.invoke(Proxy.java:393)
at $Proxy0.intercept(Unknown Source)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at net.luoo.LuooFM.http.OkHttpManager.lambda$initOkHttp3V3$0$OkHttpManager(OkHttpManager.java:152)
at net.luoo.LuooFM.http.OkHttpManager$$Lambda$0.intercept(Unknown Source)
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)
OkHttpManager.java:152是
return chain.proceed(builder.url(request.url()).build());
这是请求:
@GET("/musics/songs/{id}")
Call<Song> getSong(@Path("id") long id);
如果我使用Observable<Song> getSong(@Path("id") long songId);
,则可以正常使用