Error reported when uploading to Android Playstore

Viewed 610

I am trying to upload my app on playstore but playstore is giving me error which is related to networking library and its not letting me pass untill I fix it. Here is the stack trace for that :

StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Lcom/android/org/conscrypt/ConscryptEngineSocket;->setUseSessionTickets(Z)V
    at android.os.StrictMode.lambda$static$1(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$1(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)

My App specifications :

minSdkVersion = 19
targetSdkVersion = 30
compileSdkVersion = 30
buildToolsVersion = '28.0.2'

Networking library used :

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'

Please let me know is there any way to resolve this.

1 Answers

The error is being returned because your app is trying to use setUseSessionTickets, which is not permitted. This was previously used by OkHttp, and is fixed in more recent versions.

This issue is fixed in version 3.12.9+, you need to use that version or newer:

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”.

Note that whilst the patch notes don't explicitly mention your issue, they do refer to the restricted methods causing your problem.

Related