Android Question Help with Android compatibility errors

MrKim

Well-Known Member
Licensed User
Longtime User
After uploading my app I have nineteen compatibility errors.
These 4
B4X:
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/os/Message;->flags:I
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/os/Message;->recycleUnchecked()V
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/os/Message;->when:J
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/os/MessageQueue;->next()Landroid/os/Message
I found reference to HERE. I have only MsgboxAsync and xui.msgboxasync and no DoEvents so evidently they are OK?

Another 8 Google says "This issue may be associated with Google supplied library Android WebView. We know about this issue, and we are working on it. There is nothing you need to do right now."
So I guess I am OK there.

That leaves the following (Leaving out duplicates)
B4X:
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Ljava/nio/Buffer;->address:J
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/content/Context;->bindServiceAsUser(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/Handler;Landroid/os/UserHandle;)Z
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard;
rictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Ldalvik/system/CloseGuard;->warnIfOpen()V
These are the libs I am using if that helps.
1617424188613.png


I also noted the other errors mentioned in the link above contained Ldalvik/system .

I am using the following code to read barcodes and on some google tested platforms it failed:

B4X:
Private Sub CreateDetector (Codes As List)
    Dim ctxt As JavaObject
    ctxt.InitializeContext
    Dim builder As JavaObject
    builder.InitializeNewInstance("com/google/android/gms/vision/barcode/BarcodeDetector.Builder".Replace("/", "."), Array(ctxt))
    Dim barcodeClass As String = "com/google/android/gms/vision/barcode/Barcode".Replace("/", ".")
    Dim barcodeStatic As JavaObject
    barcodeStatic.InitializeStatic(barcodeClass)
    Dim format As Int
    For Each formatName As String In Codes
        format = Bit.Or(format, barcodeStatic.GetField(formatName))
    Next
    builder.RunMethod("setBarcodeFormats", Array(format))
    detector = builder.RunMethod("build", Null)
    Dim operational As Boolean = detector.RunMethod("isOperational", Null)
    If operational = False Then
        Toast.Show("Failed to create detector you may not be able to use QR Code Method.", Null)
    End If
End Sub

Perhaps that is related?
Let me know and I will post the full error logs if needed.
Thanks for your help.
 
Top