Android Question How to support JAVA8 feature

ppgirl

Member
Licensed User
Longtime User
Hi All,

Recently, I have found some problems in the integration of third-party AAR libraries. Third-party libraries have begun to use the features of JAVA8, resulting in errors with B4A compilation (#AdditionalJar). Of course, removing the JAVA8 features of third-party libraries may temporarily solve Question. But I still want to know how to make B4A support the features of JAVA8.

B4A Version: 8.30
Parsing code. (0.01s)
Compiling code. (4.48s)
Compiling layouts code. (0.01s)
Organizing libraries. (6.58s)
Generating R file. (4.05s)
Compiling generated Java code. (9.38s)
Convert byte code - optimized dex. Error
Uncaught translation error: com.android.dx.cf.code.SimException: default or static interface method used without --min-sdk-version >= 24
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: java.lang.IllegalArgumentException: already added: Lio/reactivex/internal/operators/flowable/FlowableRepeatWhen$WhenReceiver;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lio/reactivex/internal/util/BlockingIgnoringReceiver;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/common/util/concurrent/AbstractExecutionThreadService;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/common/util/concurrent/AbstractExecutionThreadService$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/common/util/concurrent/AbstractExecutionThreadService$1$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/common/util/concurrent/AbstractExecutionThreadService$1$2;
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:692)
at com.android.dx.command.dexer.Main.runMultiDex(Main.java:370)
at com.android.dx.command.dexer.Main.runDx(Main.java:291)
at com.android.dx.command.dexer.Main.main(Main.java:249)
at com.android.dx.command.Main.main(Main.java:94)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:684)
... 4 more
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
According to discussion in stackoverflow ,"In the project gradle.properties, add:android.enableD8=true" ,
This seems to solve only one of the errors. My guess is that you are referencing the wrong library. A Java library instead of an Android library.

Anyway, you cannot use this option with B4A.
 
Upvote 0

ppgirl

Member
Licensed User
Longtime User
Thank for your answer.

I am working on Rocket.Chat application (Kotlin, Java1.8) source to a AAR library , and It is complied complete in android studio 3.x.

it looks like hard to merge into B4A project.
 
Upvote 0
Top