Java Question androidx.media2:media2-session produce error

Pendrush

Well-Known Member
Licensed User
Longtime User
B4X:
#AdditionalJar: androidx.media2:media2-session
will produce error:
B4A Version: 10.50
Parsing code. (0.00s)
Java Version: 11
Building folders structure. (0.01s)
Compiling code. (0.01s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Generating R file. (0.00s)
Compiling generated Java code. (0.06s)
Convert byte code - optimized dex. Error
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
1 error; aborting
Same error with
B4X:
#AdditionalJar: androidx.media2:media2-widget
and
#AdditionalJar: androidx.media2:media2-player

Is there any solution?
 

moster67

Expert
Licensed User
Longtime User
MIght be due to fact that the jar includes Java 8 features and needs to be "desugared".
See this thread which might resolve your issue
 

Pendrush

Well-Known Member
Licensed User
Longtime User
androidx.media2:media2-widget
androidx.media2:media2-session
androidx.media2:media2-player

All are downloaded with SDK Manager, why is not desugared after download?
 

DonManfred

Expert
Licensed User
Longtime User
All are downloaded with SDK Manager, why is not desugared after download?
Not all needs to be desugared. So it would be wrong to do it all the time.

In this case it is needed.
 

Pendrush

Well-Known Member
Licensed User
Longtime User
As Android Studio do it as it needed I don't see any reason why SDK Manager don't do it in the same way.
This will be a problem to do on my local computer as these 3 have few more dependencies and then need to be included in library. As they can be downloaded and updated with with SDK Manager, this solution is wrong in my opinion.
Than you both for your responses.
 
Top