Android Question B4X RuntimePermissions Failing completely in 10.2

Status
Not open for further replies.

MrKim

Well-Known Member
Licensed User
Longtime User
I just installed 10.2 partly to see if it would solve this problem. But now I get a new error - all RuntimePermissions that I use are failing with the same error. This error occurs on

RP.Check(RP.PERMISSION_WRITE_EXTERNAL_STORAGE)
RP.Check(RP.PERMISSION_CALL_PHONE) and
RP.Check(RP.PERMISSION_CAMERA)

Android 29 manifest target 28. Pixel 3 XL Android Version 10. Build number is QQ3A.200805.001
Log:
B4X:
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/content/ContextCompat;
    at anywheresoftware.b4a.objects.RuntimePermissions.Check(RuntimePermissions.java:73)
    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:348)
    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.raiseEvent(BA.java:193)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:7259)
    at android.view.View.performClickInternal(View.java:7236)
    at android.view.View.access$3600(View.java:801)
    at android.view.View$PerformClick.run(View.java:27892)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.ClassNotFoundException: androidx.core.content.ContextCompat
    ... 20 more

To be clear, before the update only PERMISSION_WRITE_EXTERNAL_STORAGE was failing as mentioned in the link above and it was a different issue. Now everything fails.
 

MrKim

Well-Known Member
Licensed User
Longtime User
You are using a very old Android SDK.
Carefully follow the installation instructions and it will work: https://www.b4x.com/b4a.html
I carefully followed the instructions. Put everything in new directories on a different drive. Renamed all of the old folders. Now it fails on printer.

B4X:
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/print/PrintHelper;
    at anywheresoftware.b4a.objects.PdfDocumentWrapper$Printer.Initialize(PdfDocumentWrapper.java:119)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
    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.raiseEvent(BA.java:193)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:7259)
    at android.view.View.performClickInternal(View.java:7236)
    at android.view.View.access$3600(View.java:801)
    at android.view.View$PerformClick.run(View.java:27892)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.ClassNotFoundException: android.support.v4.print.PrintHelper
    ... 20 more
I Jetified as well.

1600581760638.png

When I was done I had two javac.exe. I tried them both but same result.
1600581858379.png




Printhelper is now in a different location that it was before relative to javac.
1600582003615.png

1600582316227.png

1600582352950.png
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
Maybe not related to your problem, but Additional Libraries must not be located in Program Files folder.
Put them in a separate folder like you did for Java and Android SDK.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You additional libs folder should NOT be placed in the program files folder. This is a restricted folder.
Create a AddLibs Folder in C:\Android
D:\Android\AddLibs\
Create the Folders B4A, B4I, B4J, B4R and B4X in D:\Android\AddLibs\
D:\Android\AddLibs\B4A\
D:\Android\AddLibs\B4I\
D:\Android\AddLibs\B4J\
D:\Android\AddLibs\B4R\
D:\Android\AddLibs\B4X\

Make sure to configure the IDE to use D:\Android\AddLibs\ for the Additional libraries.
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
This is a different error. Can you post the compilation window text?
B4X:
B4A Version: 10.2
Java Version: 11
Parsing code.    (0.47s)
Building folders structure.    (0.09s)
Running custom action.    (0.45s)
Compiling code.    (2.32s)
Compiling layouts code.    (0.07s)
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Generating R file.    (0.49s)
Compiling debugger engine code.    (5.36s)
Compiling generated Java code.    (4.73s)
Convert byte code - optimized dex.    (4.57s)
Packaging files.    (1.14s)
Copying libraries resources    (0.05s)
    Found 1 resource files.
Signing package file (private key).    (1.38s)
ZipAlign file.    (0.19s)
Installing file to device.    (2.57s)
    Device serial: 8AWY0RSS6
Completed successfully.
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
You additional libs folder should NOT be placed in the program files folder. This is a restricted folder.
Create a AddLibs Folder in C:\Android
D:\Android\AddLibs\
Create the Folders B4A, B4I, B4J, B4R and B4X in D:\Android\AddLibs\
D:\Android\AddLibs\B4A\
D:\Android\AddLibs\B4I\
D:\Android\AddLibs\B4J\
D:\Android\AddLibs\B4R\
D:\Android\AddLibs\B4X\

Make sure to configure the IDE to use D:\Android\AddLibs\ for the Additional libraries.
Now this is where I start getting confused. When I was originally just working with B4A way back when new libs went in
C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries
Erel (Above) just tells me "Download the Printer Library again."
That's fine but where do I put it now?
C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries?
C:\Android\AddLibs\B4A?
C:\Android\AddLibs?

As I recall originally it was just one place for additional libs so I have everything in there. B4A, B4I, B4J, B4X.

So now if I want to change to the structure you recommend how do I know what to put where?

I have been operating for years with a bit of a mess and I would like to clean it up but I am just not sure how to go about it.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Now this is where I start getting confused. When I was originally just working with B4A way back when new libs went in
C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries
These are the INTERNAL libraries. They are ok to be there.

ANY other Library should be placed in the additional libs folder. The Folder for the additional libs should NOT be writeprotected as the jettifiertool need to write there.
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
These are the INTERNAL libraries. They are ok to be there.

ANY other Library should be placed in the additional libs folder. The Folder for the additional libs should NOT be writeprotected as the jettifiertool need to write there.
Here is the problem. Several years ago I didn't do this. I just dumped everything in the internal directories directory. I was only using B4A and it worked fine, and it got the job done. 2 or 3 years ago I started playing with B4J when I read something that said "don't put stuff in the internal libs directory!!" So I created a directory called B4XLibs and dumped everything new in there. Now I am paying the price. I would like to clean it up but have no idea what goes where. I probably have stuff in the B4I, B4J, And B4A internal libs directories that doesn't belong there and stuff in my shared directory that doesn't belong there.

A good start would be a listing of what SHOULD be in each of the respective internal libs. Then I could at least move out what doesn't belong there.
 
Upvote 0

udg

Expert
Licensed User
Longtime User
Installing an update of any B4x product (in a dir different from the existing one) leads to a clean Internal Libraries list.
If you'd like to keep more than one version of the same product, you can do it just installing each time in a different dir. Something like:
C:\Program Files (x86)\Anywhere Software\B4A\B4A650
C:\Program Files (x86)\Anywhere Software\B4A\B4A900
C:\Program Files (x86)\Anywhere Software\B4A\B4A1002

Note: keep in mind that it's recommended to use the latest version of each product

At the same time, the Additional Lib dir should be on a not-restricted path (eg. Documents, C:\development, ... )
 
Upvote 0
Status
Not open for further replies.
Top