上传到 Android Playstore 时报告错误
Error reported when uploading to Android Playstore
我正在尝试将我的应用程序上传到 Playstore,但 Playstore 给我一个与网络库相关的错误,并且在我修复它之前不让我通过。这是堆栈跟踪:
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Lcom/android/org/conscrypt/ConscryptEngineSocket;->setUseSessionTickets(Z)V
at android.os.StrictMode.lambda$static(StrictMode.java:416)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at java.lang.Class.getDeclaredMethodInternal(Native Method)
at java.lang.Class.getPublicMethodRecursive(Class.java:2079)
at java.lang.Class.getMethod(Class.java:2066)
at java.lang.Class.getMethod(Class.java:1693)
at j.g0.k.e.a(Unknown Source:1)
at com.google.firebase.perf.network.FirebasePerfOkHttpClient.execute(Unknown Source:17)
at d.d.i.d.b(Unknown Source:150)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at d.d.d.f$a.run(Unknown Source:11)
at java.lang.Thread.run(Thread.java:923)StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Lcom/android/org/conscrypt/ConscryptEngineSocket;->setUseSessionTickets(Z)V
at android.os.StrictMode.lambda$static(StrictMode.java:416)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at java.lang.Class.getDeclaredMethodInternal(Native Method)
at java.lang.Class.getPublicMethodRecursive(Class.java:2079)
at java.lang.Class.getMethod(Class.java:2066)
at java.lang.Class.getMethod(Class.java:1693)
at com.google.firebase.perf.network.FirebasePerfOkHttpClient.execute(Unknown Source:17)
at d.d.i.d.b(Unknown Source:150)
at d.d.i.e.c(Unknown Source:3)
at d.d.i.e.run(Unknown Source:23)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at d.d.d.f$a.run(Unknown Source:11)
at java.lang.Thread.run(Thread.java:923)
我的应用程序规格:
minSdkVersion = 19
targetSdkVersion = 30
compileSdkVersion = 30
buildToolsVersion = '28.0.2'
使用的网络库:
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.1'
请告诉我有什么办法可以解决这个问题。
返回错误是因为您的应用正在尝试使用 setUseSessionTickets
,这是不允许的。这以前被 OkHttp 使用,并在更新的版本中得到修复。
此问题是fixed in version 3.12.9+,您需要使用该版本或更高版本:
Version 3.12.9
2020-02-24
- Fix: Don’t crash on Android 11 due to use of restricted methods. This prevents a crash with the exception, “Expected Android API level
21+ but was 29”.
请注意,虽然补丁说明没有明确提及您的问题,但它们确实提到了导致您出现问题的受限方法。
我正在尝试将我的应用程序上传到 Playstore,但 Playstore 给我一个与网络库相关的错误,并且在我修复它之前不让我通过。这是堆栈跟踪:
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Lcom/android/org/conscrypt/ConscryptEngineSocket;->setUseSessionTickets(Z)V
at android.os.StrictMode.lambda$static(StrictMode.java:416)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at java.lang.Class.getDeclaredMethodInternal(Native Method)
at java.lang.Class.getPublicMethodRecursive(Class.java:2079)
at java.lang.Class.getMethod(Class.java:2066)
at java.lang.Class.getMethod(Class.java:1693)
at j.g0.k.e.a(Unknown Source:1)
at com.google.firebase.perf.network.FirebasePerfOkHttpClient.execute(Unknown Source:17)
at d.d.i.d.b(Unknown Source:150)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at d.d.d.f$a.run(Unknown Source:11)
at java.lang.Thread.run(Thread.java:923)StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Lcom/android/org/conscrypt/ConscryptEngineSocket;->setUseSessionTickets(Z)V
at android.os.StrictMode.lambda$static(StrictMode.java:416)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at java.lang.Class.getDeclaredMethodInternal(Native Method)
at java.lang.Class.getPublicMethodRecursive(Class.java:2079)
at java.lang.Class.getMethod(Class.java:2066)
at java.lang.Class.getMethod(Class.java:1693)
at com.google.firebase.perf.network.FirebasePerfOkHttpClient.execute(Unknown Source:17)
at d.d.i.d.b(Unknown Source:150)
at d.d.i.e.c(Unknown Source:3)
at d.d.i.e.run(Unknown Source:23)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at d.d.d.f$a.run(Unknown Source:11)
at java.lang.Thread.run(Thread.java:923)
我的应用程序规格:
minSdkVersion = 19
targetSdkVersion = 30
compileSdkVersion = 30
buildToolsVersion = '28.0.2'
使用的网络库:
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.1'
请告诉我有什么办法可以解决这个问题。
返回错误是因为您的应用正在尝试使用 setUseSessionTickets
,这是不允许的。这以前被 OkHttp 使用,并在更新的版本中得到修复。
此问题是fixed in version 3.12.9+,您需要使用该版本或更高版本:
Version 3.12.9
2020-02-24
- Fix: Don’t crash on Android 11 due to use of restricted methods. This prevents a crash with the exception, “Expected Android API level 21+ but was 29”.
请注意,虽然补丁说明没有明确提及您的问题,但它们确实提到了导致您出现问题的受限方法。