Android Question Error compiling uncaught translation error

techknight

Well-Known Member
Licensed User
Longtime User
So I updated B4A and the Android SDK to the latest SDK, and I noticed that compile time has been drastically extended, and now im getting an error...

B4X:
B4A Version: 10.2
Java Version: 8
Parsing code.    (1.23s)
Building folders structure.    (5.77s)
Compiling code.    (1.72s)
    
ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code.    (0.35s)
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Generating R file.    (16.41s)
Compiling generated Java code.    (27.04s)
Convert byte code - optimized dex.    Error
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Address;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Authenticator;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Authenticator$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache$2;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache$CacheRequestImpl;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache$CacheRequestImpl$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache$CacheResponseBody;
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.runMonoDex(Main.java:315)
    at com.android.dx.command.dexer.Main.runDx(Main.java:293)
    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

Not sure what to do next.
 

techknight

Well-Known Member
Licensed User
Longtime User
Did you use Erel's SDK from the B4A product page? If not try that.

If you used Erels's B4A SDK download did you use 7-Zip or another program to unzip the SDK and NOT File Explorer which can mangle the paths when unzipping?

yes, I did all that. Even went back to my backup copies to make sure. No change. Change happened when updating to B4A 10.2

Turns out, it was the AppUpdating library with DependsOn okhttp3.x.x.x.x.x something another. I had to remove that.

Why this is an issue is beyond me. compilers should be smart enough to know if a library is included multiple times, not to build it multiple times!
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
compilers should be smart enough to know if a library is included multiple times, not to build it multiple times!
The compiler doesn't add the same library multiple times. The problem is that a new version of OkHttp was released and it has a different name. The solution is to switch to the b4xlib version of AppUpdating or use the source code.
 
Upvote 0
Top