-
-
Notifications
You must be signed in to change notification settings - Fork 735
Description
Yesterday when I run my app's apk through Google Pre-launch Test, the apk failed on android Pie with the message "Issue: Usage of non-SDK interfaces".
After some research, I found out that this error address the uses of hidden or undocumented API.
As everyone knows Android Pie starting to crack down on many improper usages of SDK and to detect them you can use Strict Mode.
Here is how I enable StrictMode in Application onCreate()
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectNonSdkApiUsage()
.penaltyLog()
.penaltyDeath()
.build());
Strict mode detecting that Parse SDK use reflection when initializing ParseHttpClients and stops the app from opening. Here is the full log from Android Studio
StrictMode: StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard;
at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at java.lang.Class.getDeclaredMethodInternal(Native Method)
at java.lang.Class.getPublicMethodRecursive(Class.java:2075)
at java.lang.Class.getMethod(Class.java:2063)
at java.lang.Class.getMethod(Class.java:1690)
at okhttp3.internal.platform.AndroidPlatform$CloseGuard.get(AndroidPlatform.java:299)
at okhttp3.internal.platform.AndroidPlatform.<init>(AndroidPlatform.java:48)
at okhttp3.internal.platform.AndroidPlatform.buildIfSupported(AndroidPlatform.java:204)
at okhttp3.internal.platform.Platform.findPlatform(Platform.java:172)
at okhttp3.internal.platform.Platform.<clinit>(Platform.java:73)
at okhttp3.internal.platform.Platform.get(Platform.java:79)
at okhttp3.internal.tls.CertificateChainCleaner.get(CertificateChainCleaner.java:41)
at okhttp3.OkHttpClient.<init>(OkHttpClient.java:251)
at okhttp3.OkHttpClient$Builder.build(OkHttpClient.java:907)
at com.parse.ParseHttpClient.<init>(ParseHttpClient.java:64)
at com.parse.ParseHttpClient.createClient(ParseHttpClient.java:38)
at com.parse.ParsePlugins.restClient(ParsePlugins.java:126)
at com.parse.Parse.getEventuallyQueue(Parse.java:594)
at com.parse.Parse.access$800(Parse.java:36)
at com.parse.Parse$1.call(Parse.java:400)
at com.parse.Parse$1.call(Parse.java:397)
at bolts.Task$4.run(Task.java:357)
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:764)
SDK version 1.16.3 and 1.18.5
There are also a few more minor problem detected with Strict mode but this paticular usage is consider a crashes / bug for Google bot tester