Android Question Problem after updating to Mobile ads v20

Status
Not open for further replies.

tufanv

Expert
Licensed User
Longtime User
Hello,

To use firebaseadmob 2 I updated the googlemobileads sdk to 20. After that I got some error messages regarding firebase encoders, androidwork etc. I updated them all with sdk manager but I started to get:

B4X:
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)

after some research on the forum I added:

#MultiDex: True

and now I am getting:

B4X:
B4A Version: 10.70
Parsing code.    (0.12s)
    Java Version: 11
Building folders structure.    (0.02s)
Compiling code.    (0.13s)
    
ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code.    (0.01s)
Organizing libraries.    (0.04s)
    (AndroidX SDK)
Compiling resources    (0.19s)
Linking resources    (0.72s)
Compiling generated Java code.    (2.76s)
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)

I tried to remove sdk file completely and reinstall as described in b4a product page, only updated the mobile ads sdk again which led to other updates againn and same errors again. What can I do about it?

Thanks
 

tufanv

Expert
Licensed User
Longtime User
I'm not able to install Firebase BoM, all other installed and updated.
B4X:
Downloading: https://dl.google.com/dl/android/maven2/master-index.xml
Downloading: https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-bom/27.0.0/firebase-bom-27.0.0.pom
Downloading: https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-bom/27.0.0/firebase-bom-27.0.0.jar
<title>Error 404 (Not Found)!!1</title>
same here, just noticed the error.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The problem is in androidx.work:work-runtme v2.5.0. It includes a predexed jar.

I've configured the recommended resource list to download v2.4.0.
If you are getting this error then you've already downloaded v2.5.0.

Fix it by:
1. Close B4A Sdk Manager.
2. Edit <android sdk>\extras\b4a_remote\installed-components.txt
3. Find and delete the line that starts with: androidx.work\:work-runtime
4. Open B4A Sdk Manager and the correct version will appear in the recommended items.
 
Upvote 0

artsoft

Active Member
Licensed User
Longtime User
It works at me now!!! :)

PRE-DEXING is obsolete now.
I am able to set my project now in MULTIDEX mode and able to compile it.


Great Erel!
Thanks a lot.
 
Upvote 0

kstainsb

Member
Licensed User
Longtime User
The problem is in androidx.work:work-runtme v2.5.0. It includes a predexed jar.

I've configured the recommended resource list to download v2.4.0.
If you are getting this error then you've already downloaded v2.5.0.

Fix it by:
1. Close B4A Sdk Manager.
2. Edit <android sdk>\extras\b4a_remote\installed-components.txt
3. Find and delete the line that starts with: androidx.work\:work-runtime
4. Open B4A Sdk Manager and the correct version will appear in the recommended items.

Hello, I also had the same errors, so tried this. When I delete the line in the installed-components textfile, then save, the SDK manager doesn't show any recommended components. If I search manually for work-runtime it shows only version 2.5.0. I've obviosuly done something wrong or missed a step! Can anyone help?!
 
Upvote 0

sdesan

Member
Licensed User
Longtime User
Hello, I also had the same errors, so tried this. When I delete the line in the installed-components textfile, then save, the SDK manager doesn't show any recommended components. If I search manually for work-runtime it shows only version 2.5.0. I've obviosuly done something wrong or missed a step! Can anyone help?!

I have the same problem: B4A 10.70.
I have removed work-runtime 2.5
Cattura.JPG


But in SDK manager I find only version 2.5

Cattura.JPG


i have also downloaded FirebaseAdMob2 (i use it in my app) buti have this error

Compilazione del codice Java prodotto. (0.02s)
Conversione byte code - ottimizzazione 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)

if i put in Project Attributes
B4X:
#MultiDex: True
the error reduces to
Conversione byte code - ottimizzazione 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)

'Till two days ago, before i added some library for try https://www.b4x.com/android/forum/threads/b4xpages-the-almost-definitive-admob-example.113586/ example, app and compilation don't have any problems.... But i don't rember what library i have adde.
Can anyone help me ?!?
 
Upvote 0

kstainsb

Member
Licensed User
Longtime User
Don't confuse androidx.work\:work-runtime with androidx.work\:work-runtime-ktx
Hi Erel, no its both showing as only version 2.5.0 in the SDK manager. I had to remove adverts to get my app to compile, which is not a solution I can use for release.
 
Upvote 0

superkan

Member
Licensed User
I was getting the same error namely: work-runtime 2.5 got installed by me perhaps during an sdk update and I was not able to find the 2.4 version in the list to fix the "Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)" while using(just referencing is enough to cause the error) just the FirebaseAdMob2 internal library. (tried desugaring but that was failed effort)

As was told in this thread - It is not mandatory right now to use the 2.0 library above for AdMob Ads.

If you have used it and are getting the error this is how i fixed it:
1) Went back to Version 10.6 of B4A.
2) Started clean with the two supplied zips into a new empty folder as directed.
3) Just updated the above new sdk path in the IDE>paths.

No need to start SDK manager, error gone away on next launch of IDE.
 
Upvote 0

MikeSW17

Active Member
Licensed User
Longtime User
I'm not able to compile project:
Compiles OK here.
B4X:
B4A Version: 11.00 BETA #1
Parsing code.    (0.00s)
    Java Version: 11
Building folders structure.    (0.02s)
Compiling code.    (0.05s)
Compiling layouts code.    (0.04s)
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Compiling resources    (25.98s)
Linking resources    (4.43s)
Compiling generated Java code.    (12.89s)
Convert byte code - optimized dex.    (10.40s)
Copying libraries resources    (3.41s)
ZipAlign file.    (1.88s)
Signing package file (private key).    (10.61s)
Installing file to device.
 
Upvote 0
Status
Not open for further replies.
Top