Android Question cannot build my project

ilan

Expert
Licensed User
Longtime User
wanted to update an old project but am not able to do it:

B4A Version: 10.50
Parsing code. (0.14s)
Java Version: 8
Building folders structure. (0.01s)
Compiling code. (0.26s)
Compiling layouts code. (0.03s)
Organizing libraries. (0.04s)
(AndroidX SDK)
Generating R file. (0.56s)
Compiling debugger engine code. (2.89s)
Compiling generated Java code. (3.21s)
Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$8.updateIndex(DexMerger.java:565)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:276)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:574)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:166)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:336)
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)


i have downloaded the sdk folder again and replaced it with the existing one. i have installed firebase-encoders but still get this error:

SDK version: 6609375

what is the problem?
 

ilan

Expert
Licensed User
Longtime User
B4X:
#MultiDex: True

doesnot work i get this:

B4A Version: 10.50
Parsing code. (0.08s)
Java Version: 8
Building folders structure. (0.41s)
Compiling code. (0.20s)
Compiling layouts code. (0.03s)
Organizing libraries. (0.04s)
(AndroidX SDK)
Generating R file. (0.50s)
Compiling debugger engine code. (1.55s)
Compiling generated Java code. (1.88s)
Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Library dex files are not supported in multi-dex mode
at com.android.dx.command.dexer.Main.runMultiDex(Main.java:371)
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)
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
what i try:

- reinstall b4a (latest version 10.5)
- replaced sdk folder
- replaced SDK tools folder
- installed all suggested SDK packages in SDK manager
- reinstall android studio
- restarted pc about 14 times
- searched here without any success
- searched google also without any success (all i got there was using multi dex and that did not resolve the issue)

i need to mention that I had other errors that i managed to solve but got stuck on this error:

B4A Version: 10.50
Parsing code. (0.14s)
Java Version: 8
Building folders structure. (0.01s)
Compiling code. (0.26s)
Compiling layouts code. (0.03s)
Organizing libraries. (0.04s)
(AndroidX SDK)
Generating R file. (0.56s)
Compiling debugger engine code. (2.89s)
Compiling generated Java code. (3.21s)
Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$8.updateIndex(DexMerger.java:565)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:276)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:574)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:166)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:336)
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)

have no idea what esle i can do :(
 
Last edited:
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
For error
B4X:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
you need to set
B4X:
#MultiDex: True
for second error after you have set #MultiDex: True I don't have any solution.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
For error
B4X:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
you need to set
B4X:
#MultiDex: True
for second error after you have set #MultiDex: True I don't have any solution.

thank you for trying to help. i will wait until erel will have a look at this thread.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Did you update the Android SDK Command line tools and required resources ?

Double check you have followed rigidly every step: https://www.b4x.com/b4a.html
Use 7-Zip to extract Zips, Windows Extract can/does corrupt the folder structure.

yes i did. so i can tell exactly what i did.

1. i removed everything in my c:\Android folder
2. download Android SDK Command Line tools (ver 6609375 ) and copy to c:\Android Folder
3. download required resources and copy to c:\Android Folder

NOW! if i try to run the project it WORKS!

then i open SDK Manager and update ALL suggested packages and here starts the issue

i get Error when i try to build about
androidx.work:work-runtime is missing

so i go to sdk manager and install that package

then i get a new error:
com.google.firebase/firebase-encoders so i go to sdk manager and install that package

after that i get the error:

B4A Version: 10.50
Parsing code. (0.12s)
Java Version: 8
Building folders structure. (0.02s)
Compiling code. (0.26s)
Compiling layouts code. (0.03s)
Organizing libraries. (0.04s)
(AndroidX SDK)
Generating R file. (0.66s)
Compiling debugger engine code. (2.56s)
Compiling generated Java code. (3.21s)
Convert byte code - optimized dex. Error
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/DataEncoder;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/Encoder;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/EncodingException;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/ObjectEncoder;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/ObjectEncoderContext;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/ValueEncoder;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/ValueEncoderContext;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/annotations/Encodable;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/encoders/annotations/Encodable$Field;
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

so there is a package in the SDK suggested packages that does the problem.

this is the list that the SDK Managaer wants me to install after re-install the required resourcess.


l1.PNG l2.PNG l3.PNG l4.PNG l5.PNG

AGAIN, if i don't install those Packages everything runs fine after installing them i need to install 2 more packages as described above and then i get the Dexer error.

what should i do?
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
In most cases you don't need to touch the sdk manager at all

:eek:
really? i always made sure i was up to date in the sdk manager and that usually broke something in my code.
if i download the "required resources" and the "command line tool" and unzip to c:\android folder everything works fine only after updating the packages in sdk manager i start getting problems. but if you say i dont have to update then it is fine for me. :)


1612079507890.png


those are the libs i use.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
As erel already said. In most cases you dont need to update the sdk packages.

download the "required resources" and the "command line tool" and unzip to c:\android folder. But first remove everything from that folder as explained in the b4a install documentation.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Maybe this:
 
Upvote 0

Almora

Active Member
Licensed User
Longtime User
Maybe this:

didn't work


.
 
Upvote 0

Almora

Active Member
Licensed User
Longtime User
do you mean that you are not able to run the emulator from B4A? i run it from Android Studio.
I only "required resources" "command line tool" and emulator installed. I did not install additional components (maven)
problem is solved..
 
Upvote 0
Top