java.lang.NoSuchMethodError No virtual method log(ILjava/lang/String;Ljava/lang/Throwable
Where did the problem occur?
case A
java.lang.ExceptionInInitializerError
at okhttp3.internal.platform.Platform.get(Platform.java:85)
at okhttp3.OkHttpClient.newSslSocketFactory(OkHttpClient.java:263)
at okhttp3.OkHttpClient.<init>(OkHttpClient.java:229)
at okhttp3.OkHttpClient$Builder.build(OkHttpClient.java:1015)
Case B.
22965-23063 E/AndroidRuntime: FATAL EXCEPTION: RxIoScheduler-3
Process: aaa.bbb.ccc.debug, PID: 22965
java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:59)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
# 문제가 발생하는 구체적인 지점.
Caused by: java.lang.NoSuchMethodError: No virtual method log(ILjava/lang/String;Ljava/lang/Throwable;)V in class Lokhttp3/internal/platform/Platform; or its super classes (declaration of 'okhttp3.internal.platform.Platform' appears in /data/app/~~xxxxx==/aaa.bbb.ccc.debug-eee==/base.apk!classes3.dex)
at okhttp3.logging.HttpLoggingInterceptor$Logger.lambda$static$0(HttpLoggingInterceptor.java:112)
at okhttp3.logging.-$$Lambda$HttpLoggingInterceptor$Logger$cXcBbVFwFnV7JF5qXQEzeLK-kgE.log(Unknown Source:0)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:169)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at aaa.bbb.ccc.external.retrofit.UserAgent.intercept(UserAgent.java:35)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:188)
at retrofit2.adapter.rxjava.CallExecuteOnsearch.call(CallExecuteOnsearch.java:40)
at retrofit2.adapter.rxjava.CallExecuteOnsearch.call(CallExecuteOnsearch.java:24)
at retrofit2.adapter.rxjava.BodyOnsearch.call(BodyOnsearch.java:36)
at retrofit2.adapter.rxjava.BodyOnsearch.call(BodyOnsearch.java:28)
at rx.Observable.unsafesearch(Observable.java:10327)
at rx.internal.operators.OperatorsearchOn$searchOnsearchr.call(OperatorsearchOn.java:100)
at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:230)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
WHAT did you change last?
Android compileSdkVersion 29 -> 30
WHY did it happen?
Android 11부터 비 SDK 테스트 API(AOSP에서 @TestApi로 주석이 지정된 API)는 이제 기본적으로 차단됨. 하지만 내가 사용중이던 okhttp와 retrofit은 여전히 리플렉션을 이용해서 해당 API를 요청중이였다.
// 사용중이던 OkHttp 관련 모듈과 버전
implementation 'com.squareup.okhttp3:okhttp:3.14.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.14.0'
HOW did you solve it?
해당 이슈가 해결된 버전으로 교체.
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
Reference
https://developer.android.com/about/versions/11/non-sdk-11#how-to-toggle https://github.com/square/okhttp/issues/5816
Search
Get more post