Android Question Playstore: StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation

Jmu5667

Well-Known Member
Licensed User
Hello All

We have had to re-engineer our flagship app so it can be put on the play store. A customer had requested this so they can get updates from the PS for the MDM. It is causing some grief doing this as certain feature will no longer be availble in the app. The latest report back from Google on a Samsung Galaxy S9 Android 8.0 (SDK 26)
is the following:

B4X:
Stack trace #1
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/os/Message;->flags:I
    at android.os.StrictMode.lambda$static$1(StrictMode.java:407)
    at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
    at java.lang.Class.getDeclaredField(Native Method)
    at anywheresoftware.b4a.Msgbox.<clinit>(Msgbox.java:72)
    at anywheresoftware.b4a.keywords.Common.StartService(Common.java:894)
    at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.startFromActivity(ServiceHelper.java:199)
    at com.islesystems.sos.main.onCreate(main.java:71)
    at android.app.Activity.performCreate(Activity.java:7957)
    at android.app.Activity.performCreate(Activity.java:7946)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
    at androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:2)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3530)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3707)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2220)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:237)
    at android.app.ActivityThread.main(ActivityThread.java:8016)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
Stack trace #2
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/os/Message;->flags:I
    at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
    at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
    at java.lang.Class.getDeclaredField(Native Method)
    at anywheresoftware.b4a.Msgbox.<clinit>(Msgbox.java:72)
    at anywheresoftware.b4a.keywords.Common.StartService(Common.java:894)
    at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.startFromActivity(ServiceHelper.java:199)
    at com.islesystems.sos.main.onCreate(main.java:71)
    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:2)
    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)

I dont get this error in my app when I run it, but Google seem to get it. Can anyone point me in the right direction. They also tested the same build on the following devices which did not fail, but passed 100% without any issues;

Model name
Pixel 3
Manufacturer
Google
Android version
Android 9 (SDK 28)
Locale
en_US
Screen size
1080 x 2160
Screen density (DPI)
440
RAM (total memory)
3,584 MB
OpenGL ES version
3.2
ABI
ARM64_V8
CPU
Qualcomm SDM845
--------------------------------------
Model name
Galaxy S20 5G
Manufacturer
Samsung
Android version
Android 10 (SDK 29)
Locale
en_US
Screen size
1080 x 2400
Screen density (DPI)
480
RAM (total memory)
10,752 MB
OpenGL ES version
3.2
ABI
ARM64_V8
CPU
Qualcomm SM8250
-----------------------------

This is the Full Report:

B4X:
API (unsupported)

[LIST]
[*]Warning
[*]Issue 1 of 7
[*]Called 2 times during testing
[/LIST]
API
Landroid/os/Message;->flags:I
Stack trace #1
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/os/Message;->flags:I
Show moreexpand_more


Stack trace #2
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/os/Message;->flags:I
Show moreexpand_more


API (unsupported)

[LIST]
[*]Warning
[*]Issue 2 of 7
[*]Called 2 times during testing
[/LIST]
API
Landroid/os/Message;->recycleUnchecked()V
Stack trace #1
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/os/Message;->recycleUnchecked()V
Show moreexpand_more


Stack trace #2
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/os/Message;->recycleUnchecked()V
Show moreexpand_more


API (unsupported)

[LIST]
[*]Warning
[*]Issue 3 of 7
[*]Called 2 times during testing
[/LIST]
API
Landroid/os/Message;->when:J
Stack trace #1
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/os/Message;->when:J
Show moreexpand_more


Stack trace #2
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/os/Message;->when:J
Show moreexpand_more


API (unsupported)

[LIST]
[*]Warning
[*]Issue 4 of 7
[*]Called 2 times during testing
[/LIST]
API
Landroid/os/MessageQueue;->next()Landroid/os/Message;
Stack trace #1
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/os/MessageQueue;->next()Landroid/os/Message;
Show moreexpand_more


Stack trace #2
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/os/MessageQueue;->next()Landroid/os/Message;
Show moreexpand_more


API (unsupported)

[LIST]
[*]Warning
[*]Issue 5 of 7
[*]Called 2 times during testing
[/LIST]
lightbulbThis issue may be associated with Google supplied library AndroidX. We know about this issue, and we are working on it. There is nothing you need to do right now.
API
Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z
Stack trace #1
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z
Show moreexpand_more


Stack trace #2
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z
Show moreexpand_more


API (unsupported)

[LIST]
[*]Warning
[*]Issue 6 of 7
[*]Called 2 times during testing
[/LIST]
lightbulbThis issue may be associated with Google supplied library AndroidX. We know about this issue, and we are working on it. There is nothing you need to do right now.
API
Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V
Stack trace #1
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V
Show moreexpand_more


Stack trace #2
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V
Show moreexpand_more


API (unsupported)

[LIST]
[*]Warning
[*]Issue 7 of 7
[*]Called 2 times during testing
[/LIST]
API
Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String;
Stack trace #1
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String;
Show moreexpand_more


Stack trace #2
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String;
Show moreexpand_more


Test devices without issues


Regards

John.
 
Solution
Google runs a static analyzer over the bytecode. This code will never run and will not cause any problem (unless you use the deprecated DoEvents or Msgbox calls).
Top