Android Question Error sdk-version>=26

Peekay

Member
Licensed User
I get these errors when I run my B4A project:

Compiling generated Java code. (0.03s)
Convert byte code - optimized dex. Error
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
7 errors; aborting
I think the error is in the manifest file which has the following code:
Manifest:
AddManifestText(<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/><supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:anyDensity="true"/>)
AddManifestText(<uses-feature android:name="android.hardware.telephony" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera.flash" android:required="false" />)
AddManifestText(<uses-permission
 android:name="android.permission.WRITE_EXTERNAL_STORAGE"
 android:maxSdkVersion="19" />)
AddManifestText(<uses-permission android:name="android.permission.SEND_SMS" />)
AddPermission("android.permission.INTERNET")
AddPermission("android.permission.ACCESS_FINE_LOCATION")
AddPermission("android.permission.READ_PHONE_STATE")
AddPermission("android.permission.VIBRATE")
AddPermission("android.permission.CAMERA")
AddPermission("android.permission.FLASHLIGHT")
AddPermission("android.permission.READ_CONTACTS")
AddPermission("android.permission.READ_PROFILE")
AddPermission("android.hardware.camera")
AddPermission("android.permission.ACCESS_NETWORK_STATE")
AddPermission("android.permission.WRITE_EXTERNAL_STORAGE")
AddPermission("android.permission.ACCESS_WIFI_STATE")
AddPermission("com.google.android.providers.gsf.permission.READ_GSERVICES")
AddPermission("android.permission.BLUETOOTH")
AddPermission("android.permission.GET_ACCOUNTS")
AddPermission("android.permission.SEND_SMS")
AddPermission("android.permission.READ_SMS")
AddPermission("android.permission.WRITE_SMS")
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
AddPermission("android.permission.WAKE_LOCK")
AddPermission("android.permission.DEVICE_POWER")
AddPermission("android.permission.GET_ACCOUNTS")
AddManifestText(<uses-feature android:name="android.hardware.location.gps"/>)
AddPermission("android.permission.READ_PHONE_STATE")
Any help will be appreciated.

Thanks
PK
 

JohnC

Well-Known Member
Licensed User
Well, the error says:
B4X:
invokedynamic requires --min-sdk-version >= 26
And in your manifest you have the min set to:
B4X:
android:minSdkVersion="5"
So maybe try setting the minsdkversion in the manifest to "26" and see if it runs.

But, I am curious what lib/function requires such a high minSDK level.
 

Peekay

Member
Licensed User
It gets this error before it even starts the Activity_Create sub in Main or the Service_Create sub in the starter module.
 

Peekay

Member
Licensed User
Thanks Erel,

The program looks for files which end with '.aar', from the downloaded folder '\Desugar' (where I see none), whilst I have a few hundred '.aar' files in different sub folders in my 'Program Files (x86)' folder.
How would I know which '.aar' files to desugar?
I think I do not understand the process well.

PK
 

Peekay

Member
Licensed User
Thanks Erel,

I have deleted all those folders and followed the installation instructions as suggested.
However, in the c:\java folder I now have 265 '.AAR' files in many different sub folders.
Which ones must I select to desugar?

PK
 

Peekay

Member
Licensed User
The c:\java folder was a new one I made as suggested in the link.

When I extracted the required resources it made the extras sub folder for that as your graphic of the folders shows.
I am not sure where they come from, but I presume they got installed when I ran the sdkmanager.bat in which those extras were already marked to be installed.
Can I just delete these then?
Where will I find those who needs to be desugared. There are 7 of them as my error code above shows.

PK
 

JohnC

Well-Known Member
Licensed User
All that I can say is that you haven't followed the instructions carefully. There should be 0 AARs in the java folder.
I don't think he is saying that he sees AARs in the "C:\Java" folder itself - it seems like what he is saying is that he sees these aar files in various "sub-folders" off of the \java directory (because he says "I now have 265 '.AAR' files in many different sub folders").
 

agraham

Expert
Licensed User
What is this C:\Java folder? It sounds like nothing to do with B4A. If it is the Java installation folder just leave it alone. I would delete/uninstall everything, B4A, Java and AndroidSDK and follow exactly the instructions Erel gave. Don't think you need to do anything else, it will just work.
 

JohnC

Well-Known Member
Licensed User
What is this C:\Java folder?
In the instructions that Erel pointed to, that is the suggested location to unpack (install the Java SDK) - "Download the zip and unpack it. C:\java is a good place for it."
 

Peekay

Member
Licensed User
Thanks JohnC,

The desugar thread says:
The latest version of ExoPlayer depends on 7 AAR packages. Desugaring these packages requires several steps:
- Extract the inner classes.jar from each AAR.
- Desugar it.
- Put it back or remove the original one.
I am just trying to put this into context for me to understand.
Must I only desugar Exoplayer .AAR files , or are there others. What and where are they?
Alternatively, do I need to desugar any .AAR files. How would I know which and why?
Incidentally I have 7 sdk version errors in my program regarding this, so it is only natural for me to deduce that I only need to desugar the 7 ExoPlayer .AAR files.
I am a newbie to B4A although I have programmed in VB for 45 years and in Fortran IV even longer. Please be patient with me. I know I will get there. This is my first B4A app.
I know everybody is busy and I appreciate that, but even so, I have found most members to be very helpful and tolerant.

PK
 

JohnC

Well-Known Member
Licensed User
I never used the ExoPlayer before, but half-way down on it's lib page:


It has a download called "It depends on several additional aar files (should be copied to the additional libraries folder):"

So those are probably the aar files you need to desugar. But there are EIGHT AAR files (not just 7) in that zip, so I don't know if you desugar all eight if it will effect anything.

I never desugared files before, so I can't help with that.

But, once you do desugar them, then place them in the "Additional Libraries" folder as mentioned.
 
Top