12

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)
Wrichik Basu
  • 1,005
  • 17
  • 28
  • While you'll want to try to resolve this, I don't believe this will prevent your app from being published. – Bink May 06 '21 at 16:20
  • 1
    Thanks @Bink The Google Play Console has highlighted that the error needs to be fixed before moving to prod. There are 2 errors and 10 warnings. The one above is marked as error – Manish Haldankar May 06 '21 at 22:13
  • I see. I have lots of StrictMode policy violations for my own app, but none that have ever prevented me from publishing. Perhaps this is an issue in OkHttp like you noted. I don’t use React Native, but this sounds like something that might be resolved by upgrading to the latest version if you haven’t already. – Bink May 07 '21 at 19:11
  • @ManishHaldankar I'm having the same issue with RN. Were you able to resolve this? – Newoda May 31 '21 at 17:33
  • I have the same issue in Flutter app. Is there any updates on this? – Denis Gordin Jun 03 '21 at 14:13
  • @ManishHaldankar did your app got rejected because of this? I am facing a similar problem but could n't found out any issue in the app. so was checking pre-release report and stumbled here. App got rejected because of the crash they were facing, but couldn't reproduce on all devices available. – sanister Jul 22 '21 at 09:21

2 Answers2

5

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.

2

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.

toxa_xa
  • 619
  • 6
  • 8