I have following Error in Google Play before app publish. It is not a warning but an error. I can see warnings with similar stack trace. I am not sure if the app will be rejected because of these because the summary of the Pre-launch report is confusing. It says no issues. But under stability it shows the warnings and error under Android compatibility. It seems to be caused by some library used by react-native (from some similar posts its seems like okhttp) but I am not sure what this trace means.

I am very new to react-native and am not sure how to resolve this. I could not find any solution whatsoever, just a few similar posts but no solutions. Our app release is stuck because of this issue. Any help would be greatly appreciated.

StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Lcom/android/org/conscrypt/ConscryptEngineSocket;->setHostname(Ljava/lang/String;)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 okhttp3.internal.platform.OptionalMethod.getPublicMethod(OptionalMethod.java:164)
    at okhttp3.internal.platform.OptionalMethod.getMethod(OptionalMethod.java:149)
    at okhttp3.internal.platform.OptionalMethod.invokeOptional(OptionalMethod.java:66)
    at okhttp3.internal.platform.OptionalMethod.invokeOptionalWithoutCheckedException(OptionalMethod.java:86)
    at okhttp3.internal.platform.AndroidPlatform.configureTlsExtensions(AndroidPlatform.java:123)
    at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:314)
    at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:283)
    at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:168)
    at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
    at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
    at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254)
    at okhttp3.RealCall$AsyncCall.execute(RealCall.java:200)
    at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
    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)
2

There are 2 answers

1
Edward Hsueh On

I found that change to okhttp3 3.12.13 can fix the error https://square.github.io/okhttp/changelog_3x/

In android/app/build.gradle, add the following two lines

implementation("com.squareup.okhttp3:okhttp:3.12.13")
implementation("com.squareup.okhttp3:okhttp-urlconnection:3.12.13")

However, there still exists some warnings, but at least no errors.

0
toxa_xa On

with gradlew app_name:dependencies command I found out what old firebase crashlytics version use old com.squareup.okhttp3version. Changing my gradle config to use newest firebase crashlytics solved the problem.