Android Question "InvokeDynamic Requires" error running a B4A application

DoctorDebug

Member
Licensed User
Longtime User
Erel, I am getting back into B4X after a couple year detour. I am running into the error when trying to run an example program (uses B4XTable and displays images from the gallery). I have android tools 30 installed and can otherwise run more simple applications with no issues. (The code I am trying to run verbatim is here: https://www.b4x.com/android/forum/threads/b4xtable-photos-album.103343/#content)

I admit I am lost here, I can run the b4j program fine but I guess I need to find the aar files and I cannot. Am I barking up the correct tree or is there another way to solve this problem? Thanks so much!

Edit: by b4j program I mean the "desugar all" project.

Edit 2: I figured out where the files were, copied them, ran the thing and when it got to the "desugar" step this happened:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.devtools.build.android.desugar.Desugar (file:/C:/Temp/keep/Desugar_deploy.jar) to field java.lang.invoke.InnerClassLambdaMetafactory.dumper
WARNING: Please consider reporting this to the maintainers of com.google.devtools.build.android.desugar.Desugar
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" java.lang.NullPointerException: Failed to register lambda dump directory 'C:\Users\Jeff\AppData\Local\Temp\lambdas9438314721725770138'
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:980)
at com.google.devtools.build.android.desugar.Desugar.verifyLambdaDumpDirectoryRegistered(Desugar.java:983)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:968)
 
Last edited:

DoctorDebug

Member
Licensed User
Longtime User
Just follow the installation instructions and everything will work: https://www.b4x.com/b4a.html
With respect, I did. Everything works until I use Library RuntimePermissions and then the compiler errors with "
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
1 error; aborting"
 
Upvote 0

DoctorDebug

Member
Licensed User
Longtime User

Attachments

  • sdk.PNG
    sdk.PNG
    43.8 KB · Views: 176
Upvote 0

agraham

Expert
Licensed User
Longtime User
Just follow the installation instructions and everything will work: https://www.b4x.com/b4a.html
Looks like you didn't . Unless you have a valid reason to run SDK Manager then , as the instructions say, don't. That error looks like a corrupt SDK often caused by using Windows File Manager to extract the archives. Erase it and start again making sure, as the instructions say, that you use 7-zip.
 
Upvote 0

MikeSW17

Active Member
Licensed User
It really is important to follow the installation instructions carefully + essential to extract the ZIPs with 7-Zip. Windows Extract does corrupt the folder structure. Other extractors may work but are untested.
Do not be tempted to try any 'short-cuts' or 'improvements' to the given instructions.
Don't run SDK Manager, certainly not until you have tested the basic B4A installation is working - try "Hello World" and other simple B4A projects.

Then use SDK manager only if you know you need specific features not included in 'required resources'
 
Upvote 0

rpalik

Member
Licensed User
Longtime User
This problem is caused by androidx.core:core ver. 1.6. It is necessary to look for an older SDK with version 1.0. You can use B4A SDK Manager, just avoid downloading androidx.core:core ver. 1.6. You can update everything else. Verified and tested several times.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
This problem is caused by androidx.core:core ver. 1.6. It is necessary to look for an older SDK with version 1.0. You can use B4A SDK Manager, just avoid downloading androidx.core:core ver. 1.6. You can update everything else. Verified and tested several times.
This is very bad advice. Erel has provided a pre-packaged SDK guaranteed to be compatible with the latest version of B4A. Just follow the installation instructions and it will work. Don't run SDK Manager unless you have a very specific need.
 
Upvote 0

rpalik

Member
Licensed User
Longtime User
This is very bad advice. Erel has provided a pre-packaged SDK guaranteed to be compatible with the latest version of B4A. Just follow the installation instructions and it will work. Don't run SDK Manager unless you have a very specific need.

And you end with Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba.

Just use Erel's old SDK and you can use SDK Manager as you wish with latest updates. Just don't update androidx:core. I have 5 developer machines and it just works.
Erel has to detect a bug and fix the compiler so that new versions of the SDK also compile old projects with old libraries without any modifications.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
And you end with Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba.
In that case there must be something else wrong. Most of us here are using the pre-packaged SDK and the latest B4A with no problem - as that is what it is there for! Perhaps it is your old libraries?
Erel has to detect a bug and fix the compiler so that new versions of the SDK also compile old projects with old libraries without any modifications.
Why? The new SDK for B4A v10.70 and later reflects Google latest requirements for app store signing. Anything older is now obsolete.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Erel has to detect a bug and fix the compiler so that new versions of the SDK also compile old projects with old libraries without any modifications.
There is nothing to fix in the compiler.
Old libraries work with the new SDK. There are very few old and unmaintained libraries, that access assets files in subfolders and break due to a change in the underlying packager tool.

As @agraham wrote, using an old SDK is simply a waste of time. You will encounter endless issues, especially if you are using Firebase.
BTW, you can also keep the old SDK and download a new one so there is really no risk.
 
Upvote 0
Top