apache / cordova-android

Apache Cordova Android
https://cordova.apache.org/
Apache License 2.0
3.67k stars 1.54k forks source link

Unsupported APIs warning in play store #737

Closed MadhusudhanDK closed 5 years ago

MadhusudhanDK commented 5 years ago

Bug Report

Problem

Unsupported APIs warning in play store

What is expected to happen?

Warnings should not come

What does actually happen?

Showing warnings in play store

Information

Hi

Im using ionic3, the App is very simple, in home page i am opening InAppBrowser. when app is published in store i got warnings, pls let me know what can be done to fix them

Screen Shot 2019-05-22 at 12 40 11 PM

warning 1

StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/content/Context;->bindServiceAsUser(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/Handler;Landroid/os/UserHandle;)Z
    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.getMethod(Class.java:2064)
    at java.lang.Class.getDeclaredMethod(Class.java:2047)
    at aGt.a(PG:4)
    at aGN.a(PG:10)
    at aGu.a(PG:50)
    at clB.<init>(PG:4)
    at ckV.run(PG:7)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.os.HandlerThread.run(HandlerThread.java:65)

warning 2

StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/textclassifier/logging/SmartSelectionEventTracker;->logEvent(Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;)V
    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 coC.a(PG:7)
    at org.chromium.content.browser.selection.SmartSelectionClient.<init>(PG:5)
    at cpj.a(Unknown Source:7)
    at org.chromium.android_webview.AwContents.e(PG:241)
    at org.chromium.android_webview.AwContents.d(PG:208)
    at org.chromium.android_webview.AwContents.<init>(PG:79)
    at vN.run(PG:15)
    at aEm.a(PG:13)
    at aEn.run(PG:2)
    at org.chromium.base.ThreadUtils.b(PG:30)
    at aEm.a(PG:7)
    at com.android.webview.chromium.WebViewChromiumFactoryProvider.b(PG:6)
    at com.android.webview.chromium.WebViewChromium.init(PG:107)
    at android.webkit.WebView.<init>(WebView.java:422)
    at android.webkit.WebView.<init>(WebView.java:348)
    at android.webkit.WebView.<init>(WebView.java:331)
    at android.webkit.WebView.<init>(WebView.java:318)
    at org.apache.cordova.engine.SystemWebView.<init>(SystemWebView.java:47)
    at org.apache.cordova.engine.SystemWebView.<init>(SystemWebView.java:43)
    at com.ionicframework.cordova.webview.IonicWebViewEngine.<init>(IonicWebViewEngine.java:41)
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
    at org.apache.cordova.CordovaWebViewImpl.createEngine(CordovaWebViewImpl.java:80)
    at org.apache.cordova.CordovaActivity.makeWebViewEngine(CordovaActivity.java:206)
    at org.apache.cordova.CordovaActivity.makeWebView(CordovaActivity.java:202)
    at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:146)
    at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:224)
    at org.client.ericssonpartnermobile.MainActivity.onCreate(MainActivity.java:39)
    at android.app.Activity.performCreate(Activity.java:7144)
    at android.app.Activity.performCreate(Activity.java:7135)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
    at androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:184)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2931)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6718)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/textclassifier/logging/SmartSelectionEventTracker;->logEvent(Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;)V
    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 org.chromium.content.browser.selection.SmartSelectionMetricsLogger.create(SmartSelectionMetricsLogger.java:7)
    at org.chromium.content.browser.selection.SmartSelectionClient.<init>(SmartSelectionClient.java:5)
    at org.chromium.content_public.browser.SelectionClient$$CC.createSmartSelectionClient$$STATIC$$(Unknown Source:7)
    at org.chromium.android_webview.AwContents.setNewAwContentsPreO(AwContents.java:226)
    at org.chromium.android_webview.AwContents.setNewAwContents(AwContents.java:184)
    at org.chromium.android_webview.AwContents.<init>(AwContents.java:80)
    at com.android.webview.chromium.X.run(WebViewChromium.java:14)
    at org.chromium.android_webview.WebViewChromiumRunQueue.drainQueue(WebViewChromiumRunQueue.java:13)
    at org.chromium.android_webview.WebViewChromiumRunQueue$1.run(WebViewChromiumRunQueue.java:2)
    at org.chromium.base.ThreadUtils.runOnUiThread(ThreadUtils.java:31)
    at org.chromium.android_webview.WebViewChromiumRunQueue.addTask(WebViewChromiumRunQueue.java:7)
    at com.android.webview.chromium.WebViewChromiumFactoryProvider.v(WebViewChromiumFactoryProvider.java:6)
    at com.android.webview.chromium.WebViewChromium.init(WebViewChromium.java:88)
    at android.webkit.WebView.<init>(WebView.java:422)
    at android.webkit.WebView.<init>(WebView.java:348)
    at android.webkit.WebView.<init>(WebView.java:331)
    at android.webkit.WebView.<init>(WebView.java:318)
    at org.apache.cordova.engine.SystemWebView.<init>(SystemWebView.java:47)
    at org.apache.cordova.engine.SystemWebView.<init>(SystemWebView.java:43)
    at com.ionicframework.cordova.webview.IonicWebViewEngine.<init>(IonicWebViewEngine.java:41)
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
    at org.apache.cordova.CordovaWebViewImpl.createEngine(CordovaWebViewImpl.java:80)
    at org.apache.cordova.CordovaActivity.makeWebViewEngine(CordovaActivity.java:206)
    at org.apache.cordova.CordovaActivity.makeWebView(CordovaActivity.java:202)
    at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:146)
    at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:224)
    at org.client.ericssonpartnermobile.MainActivity.onCreate(MainActivity.java:39)
    at android.app.Activity.performCreate(Activity.java:7144)
    at android.app.Activity.performCreate(Activity.java:7135)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
    at androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:184)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2931)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6718)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

warning 3

StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/textclassifier/logging/SmartSelectionEventTracker;-><init>(Landroid/content/Context;I)V
    at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
    at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
    at java.lang.Class.getDeclaredConstructorInternal(Native Method)
    at java.lang.Class.getConstructor0(Class.java:2325)
    at java.lang.Class.getConstructor(Class.java:1725)
    at coC.a(PG:6)
    at org.chromium.content.browser.selection.SmartSelectionClient.<init>(PG:5)
    at cpj.a(Unknown Source:7)
    at org.chromium.android_webview.AwContents.e(PG:241)
    at org.chromium.android_webview.AwContents.d(PG:208)
    at org.chromium.android_webview.AwContents.<init>(PG:79)
    at vN.run(PG:15)
    at aEm.a(PG:13)
    at aEn.run(PG:2)
    at org.chromium.base.ThreadUtils.b(PG:30)
    at aEm.a(PG:7)
    at com.android.webview.chromium.WebViewChromiumFactoryProvider.b(PG:6)
    at com.android.webview.chromium.WebViewChromium.init(PG:107)
    at android.webkit.WebView.<init>(WebView.java:422)
    at android.webkit.WebView.<init>(WebView.java:348)
    at android.webkit.WebView.<init>(WebView.java:331)
    at android.webkit.WebView.<init>(WebView.java:318)
    at org.apache.cordova.engine.SystemWebView.<init>(SystemWebView.java:47)
    at org.apache.cordova.engine.SystemWebView.<init>(SystemWebView.java:43)
    at com.ionicframework.cordova.webview.IonicWebViewEngine.<init>(IonicWebViewEngine.java:41)
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
    at org.apache.cordova.CordovaWebViewImpl.createEngine(CordovaWebViewImpl.java:80)
    at org.apache.cordova.CordovaActivity.makeWebViewEngine(CordovaActivity.java:206)
    at org.apache.cordova.CordovaActivity.makeWebView(CordovaActivity.java:202)
    at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:146)
    at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:224)
    at org.client.ericssonpartnermobile.MainActivity.onCreate(MainActivity.java:39)
    at android.app.Activity.performCreate(Activity.java:7144)
    at android.app.Activity.performCreate(Activity.java:7135)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
    at androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:184)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2931)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6718)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/textclassifier/logging/SmartSelectionEventTracker;-><init>(Landroid/content/Context;I)V
    at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
    at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
    at java.lang.Class.getDeclaredConstructorInternal(Native Method)
    at java.lang.Class.getConstructor0(Class.java:2325)
    at java.lang.Class.getConstructor(Class.java:1725)
    at org.chromium.content.browser.selection.SmartSelectionMetricsLogger.create(SmartSelectionMetricsLogger.java:6)
    at org.chromium.content.browser.selection.SmartSelectionClient.<init>(SmartSelectionClient.java:5)
    at org.chromium.content_public.browser.SelectionClient$$CC.createSmartSelectionClient$$STATIC$$(Unknown Source:7)
    at org.chromium.android_webview.AwContents.setNewAwContentsPreO(AwContents.java:226)
    at org.chromium.android_webview.AwContents.setNewAwContents(AwContents.java:184)
    at org.chromium.android_webview.AwContents.<init>(AwContents.java:80)
    at com.android.webview.chromium.X.run(WebViewChromium.java:14)
    at org.chromium.android_webview.WebViewChromiumRunQueue.drainQueue(WebViewChromiumRunQueue.java:13)
    at org.chromium.android_webview.WebViewChromiumRunQueue$1.run(WebViewChromiumRunQueue.java:2)
    at org.chromium.base.ThreadUtils.runOnUiThread(ThreadUtils.java:31)
    at org.chromium.android_webview.WebViewChromiumRunQueue.addTask(WebViewChromiumRunQueue.java:7)
    at com.android.webview.chromium.WebViewChromiumFactoryProvider.v(WebViewChromiumFactoryProvider.java:6)
    at com.android.webview.chromium.WebViewChromium.init(WebViewChromium.java:88)
    at android.webkit.WebView.<init>(WebView.java:422)
    at android.webkit.WebView.<init>(WebView.java:348)
    at android.webkit.WebView.<init>(WebView.java:331)
    at android.webkit.WebView.<init>(WebView.java:318)
    at org.apache.cordova.engine.SystemWebView.<init>(SystemWebView.java:47)
    at org.apache.cordova.engine.SystemWebView.<init>(SystemWebView.java:43)
    at com.ionicframework.cordova.webview.IonicWebViewEngine.<init>(IonicWebViewEngine.java:41)
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
    at org.apache.cordova.CordovaWebViewImpl.createEngine(CordovaWebViewImpl.java:80)
    at org.apache.cordova.CordovaActivity.makeWebViewEngine(CordovaActivity.java:206)
    at org.apache.cordova.CordovaActivity.makeWebView(CordovaActivity.java:202)
    at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:146)
    at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:224)
    at org.client.ericssonpartnermobile.MainActivity.onCreate(MainActivity.java:39)
    at android.app.Activity.performCreate(Activity.java:7144)
    at android.app.Activity.performCreate(Activity.java:7135)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
    at androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:184)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2931)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6718)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

like this i got 9 warnings

plugins used are

cordova-plugin-device 2.0.2 "Device"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.0.1 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"

i have also asked ionic forum here is the link (https://forum.ionicframework.com/t/unsupported-apis-warning-in-play-store/164484)

breautek commented 5 years ago

Some background information on these warnings: https://stackoverflow.com/a/51989550/4685664

In case the link disappears in the future:

Android 9 (API level 28) introduces new restrictions on the use of non-SDK interfaces, whether directly, via reflection, or via JNI. These restrictions are applied whenever an app references a non-SDK interface or attempts to obtain its handle using reflection or JNI. For more information about this decision, see Improving Stability by Reducing Usage of non-SDK Interfaces.

I don't know if anything to do with Cordova or not. The SO answer suggests that Google's own webview code is violating some of these policies so if that's the case there is probably nothing we can do but Cordova does also extend some of these classes and we do see them in your stack traces.

Creating an app with the bare minimum to reproduce the issue that investigators can clone could be very helpful to isolate the issue to a specific plugin or cordova-android platform.

dpogue commented 5 years ago

It looks like most (all?) of these are coming from within the Android WebView code (mostly from org.chromium.content.browser.selection classes), so I don't think there's anything we can fix at the Cordova level.