Android Question [SOLVED] Updating recommended SDK error

yiankos1

Well-Known Member
Licensed User
Longtime User
Hello team,

I am using 9.8 b4a version and i have just updated all SDK recommended. When i opened an old project, there was an error that a firebase-component was missing. I searched at forum about this error and a user suggested to search and install firebase-component from SDK installer. When i tried to compile, it throws me this error.

B4X:
B4A Version: 9.80
Java Version: 11
Parsing code.    (0.19s)
Building folders structure.    (0.11s)
Compiling code.    (1.24s)
Compiling layouts code.    (0.06s)
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Generating R file.    (0.00s)
Compiling debugger engine code.    (0.02s)
Compiling generated Java code.    (3.85s)
Convert byte code - optimized dex.    Error
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/components/AbstractComponentContainer;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/components/Component;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/components/Component$$Lambda$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/components/Component$$Lambda$2;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/components/Component$$Lambda$3;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/components/Component$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/components/Component$Builder;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/components/ComponentContainer;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/firebase/components/ComponentDiscovery;
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

As i see there are two more users (one, two) who have same compiling error as me.

My manifest is this: (i don't use admob, just firebase)
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.
CreateResourceFromFile(Macro, Core.NetworkClearText)
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)
CreateResourceFromFile(Macro, FirebaseAuth.FirebaseAuth)

Thank you for your time.

Stay home, stay safe.
 

sunish

Member
Licensed User
Longtime User
I was trying to compile an old B4A project in B4A 9.8. As with old steps I tried updating packages with SDK Manager.
I got this error

1) maven artifact not found: com.google.firebase/firebase-components
The error was appearing on opening the project and while compiling.
Tried various stuff found on B4A forums, including setting the SDK version in manifest file, since the project was using Admob, added the code AddReplacement($ADMOB_APP_ID$, ca-app-pub-633079497xxxxxx~xxxx929683)
No luck till I came to know that artifacts are components required and installed it using B4A SDK manager.

Finally some progress, then came the new error
Uncaught translation error: java.lang.IllegalArgumentException: already added: .....

That is when I came across the importance of following the steps in https://www.b4x.com/b4a.html

The key is to download and extract SDK Tools https://dl.google.com/android/repository/sdk-tools-windows-4333796.zip and required resources to C:\Android or whereever you have your Android files. SDK Manager will not help. If your are updating to B4A 9.8 you should download from the above 2 links.

Also I still got the error after extracting just the SDK Tools and then the required resources. Had to restart the IDE to get the compile working.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

sunish

Member
Licensed User
Longtime User
T
It is a mistake to post the links. They can change.
Just follow the installation instructions and everything will work.
True, but most inquisitive people would want to know what exctly solved the issue rather than just follow instructions. Another problem with the instructions is that, its traeting new users and users upgrading to a new versiion of B4A the same. I didn't have to download Java again nor follow steps 3 or 4 again. May be there should be a post to give instructions for upgrading to new version of B4A and for usual issues faced while updating the apps to new version. Yes there are posts, but scattered all around.

For eg when I searched for "maven artifact not found" got this solved link but that doesn't solve the issue and I get the translate error which again gives lots of posts but none of the solutions worked for me.

B4A is great and making it free is really amazing, but we end up spending lots of time searching on the forums for trivial issues, most of them caused by changes imposed by Google.
 
Upvote 0
Top