Bug? Why is my app crashing in 10.2

MitchBu

Well-Known Member
Licensed User
Longtime User
My app is working just fine in B4A 10, but in 10.2, I get the java error below.

I am not versed enough in the Java errors to find out what may be going on.

Is there any way to know where I should look in my B4A code ?

java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/content/ContextCompat;
at anywheresoftware.b4a.objects.RuntimePermissions.GetAllSafeDirsExternal(RuntimePermissions.java:134)
at com.bujardet.checkprinter.main._sdpresent(main.java:22241)
at com.bujardet.checkprinter.main$ResumableSub_Register_Click.resume(main.java:7931)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1704)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7000)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.core.content.ContextCompat" on path: DexPathList[[zip file "/data/app/com.bujardet.checkprinter-ExeAsGmAJCpbmsmQOZzglw==/base.apk"],nativeLibraryDirectories=[/data/app/com.bujardet.checkprinter-ExeAsGmAJCpbmsmQOZzglw==/lib/arm, /system/lib, /system/vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 21 more
 

josejad

Expert
Licensed User
Longtime User
Try searching, in the last days some people has reported the same,
Try to update your SDK, follow again the setup instructions

 

MitchBu

Well-Known Member
Licensed User
Longtime User
Tracking the error by stepping, I was able to find where it exactly occurs:

B4X:
Sub SDPresent() As Boolean
    Log("---SDPresent")
    Dim rtp As RuntimePermissions
    Dim s() As String = rtp.GetAllSafeDirsExternal("")
    Return(s.Length > 1)
End Sub

It is triggered by Dim s() As String = rtp.GetAllSafeDirsExternal("")
 

MitchBu

Well-Known Member
Licensed User
Longtime User
Try searching, in the last days some people has reported the same,
Try to update your SDK, follow again the setup instructions


Yes, it is the same error with RuntimePermissions. I will try to update the SDK.

Thank you José.
 

JohnC

Expert
Licensed User
Longtime User
This is a long shot, but maybe try adding this to your manifest:

B4X:
<application android:requestLegacyExternalStorage="true"  >
 

MitchBu

Well-Known Member
Licensed User
Longtime User
I am growing desperate.

I read Erel's advice at https://www.b4x.com/android/forum/t...ailing-completely-in-10-2.122539/#post-765534 :

You are using a very old Android SDK.
Carefully follow the installation instructions and it will work: https://www.b4x.com/b4a.html

So I renamed my current Android folder to Was-Android, created a new C:\Android folder, and carefully followed exactly the instructions.

Now I get the below error. I have no clue about what I should be doing :(

navigationcluster.PNG


Apparently the error could be related to the content of my project, since the default "Hello world" doe not trigger it.
 

josejad

Expert
Licensed User
Longtime User
What version of android.jar have you set up in path?


  • Download B4A Full Version
  • Open B4A.
  • Choose Tools > Configure Paths.
  • Set the path to "javac.exe" if it is empty (C:\java\jdk-11.0.1\bin\javac.exe or C:\Program Files\Java\jdk1.8.0_211\bin\javac.exe).
  • Set the path to "android.jar" (C:\Android\platforms\android-30\android.jar).
 

MitchBu

Well-Known Member
Licensed User
Longtime User
Thank you José, thank you Erel. That was it.

Now, I encounter yet another issue. What could it be ? I don't call print at the launch of the app.

----

Logger connected to: samsung SM-T585
--------- beginning of main
*** Service (starter) Create ***
Starter.Service_Create
** Service (starter) Start **
** Activity (main) Create, isFirst = true **

Samsung device
Air motion: false
Button: false
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/print/PrintHelper;
at anywheresoftware.b4a.objects.PdfDocumentWrapper$Printer.Initialize(PdfDocumentWrapper.java:119)
at com.bujardet.checkprinter.main._activity_create(main.java:941)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at com.bujardet.checkprinter.main.afterFirstLayout(main.java:105)
at com.bujardet.checkprinter.main.access$000(main.java:17)
at com.bujardet.checkprinter.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7000)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.print.PrintHelper" on path: DexPathList[[zip file "/data/app/com.bujardet.checkprinter-CkGWiPyRYLQ-YYHxMlqXCg==/base.apk"],nativeLibraryDirectories=[/data/app/com.bujardet.checkprinter-CkGWiPyRYLQ-YYHxMlqXCg==/lib/arm, /system/lib, /system/vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 18 more
** Activity (main) Resume **
 

MitchBu

Well-Known Member
Licensed User
Longtime User
Top