Android Question Firebase RemoteConfig classdef not found

Jack Cole

Active Member
Licensed User
After downloading all the recent SDK updates, I'm getting some crash reports on RemoteConfig. Any ideas? This is a difficult one because I can't reproduce it.

Fatal Exception: java.lang.NoClassDefFoundError
Failed resolution of: Ldevelopers/mobile/abt/FirebaseAbt$ExperimentPayload;
keyboard_arrow_up
com.google.firebase.remoteconfig.internal.LegacyConfigsHandler.deserializePayload (com.google.firebase:firebase-config@@19.0.0:293)
com.google.firebase.remoteconfig.internal.LegacyConfigsHandler.convertLegacyAbtExperiments (com.google.firebase:firebase-config@@19.0.0:272)
com.google.firebase.remoteconfig.internal.LegacyConfigsHandler.convertConfigHolder (com.google.firebase:firebase-config@@19.0.0:237)
com.google.firebase.remoteconfig.internal.LegacyConfigsHandler.getConvertedLegacyConfigs (com.google.firebase:firebase-config@@19.0.0:204)
com.google.firebase.remoteconfig.internal.LegacyConfigsHandler.saveLegacyConfigsIfNecessary (com.google.firebase:firebase-config@@19.0.0:151)
com.google.firebase.remoteconfig.RemoteConfigComponent$$Lambda$4.call (com.google.firebase:firebase-config@@19.0.0)
com.google.android.gms.tasks.zzv.run (Unknown Source:2)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1133)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607)
java.lang.Thread.run (Thread.java:776)
 

Jack Cole

Active Member
Licensed User
I will try doing an update. I searched the SDK downloader for Firebase-abt. I was using 17.0 and the current Firebase version is 19. I downloaded version 19 of the firebase-abt. Will see if that fixes it.
 

DonManfred

Expert
Licensed User
Unfortunately it is more complicated it seems.

I am trying to compile a new Library.
Unfortunately i get the following compile error
B4A Version: 9.50 BETA #1
Java Version: 11
Parsing code. (0.00s)
Building folders structure. (0.01s)
Compiling code. (0.01s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.02s)
(AndroidX SDK)
Generating R file. (0.00s)
Compiling generated Java code. (1.34s)
Convert byte code - optimized dex. Error
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
1 error; aborting
Usually when a SimException occurs one need to desugar the used jar/aar Files.
This is ok for any 3rd Party JARs/AARs

But i´m not sure that desugaring is the correct way for any Maven Artifacts. In the past it never happen to mavens.

I guess something has changed in the SDK what i do not know how to fix it.
Still investigating
 

DonManfred

Expert
Licensed User
The workaround is to distribute the desugared library and remove the dependency to the maven resource.
Ok, good.

the problem was firebase-config-19.0.0.aar i guess.
- I desugared it
- I removed the dependency and used the desugared jar instead
- I needed to add
B4X:
#AdditionalJar: com.google.firebase:firebase-abt
#AdditionalJar: firebase-config-ds
And used this as last entry in my Manifesteditor
B4X:
AddApplicationText(
<service android:name="com.google.firebase.components.ComponentDiscoveryService" >
<meta-data
    android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
    android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
    android:name="com.google.firebase.components:com.google.firebase.iid.Registrar"
    android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
    android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar"
    android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
    android:name="com.google.firebase.components:com.google.firebase.remoteconfig.RemoteConfigRegistrar"
    android:value="com.google.firebase.components.ComponentRegistrar"/>
<meta-data
    android:name="com.google.firebase.components:com.google.firebase.abt.component.AbtRegistrar"
    android:value="com.google.firebase.components.ComponentRegistrar"/>
</service>
)
So far i can see it now does work in my Testproject

Logger connected to: 988ad036525346515630
--------- beginning of crash
--------- beginning of main
--------- beginning of system
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
com.google.firebase.remoteconfig.internal.FirebaseRemoteConfigInfoImpl@75e34fc
com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings@e298785
loading_phrase=Hallo world!
promo_code=
Fetching
** Activity (main) Resume **
onAuthStateChanged: com.google.firebase.auth.internal.zzl@9966856
Config_onFetchComplete(true)
Activate fetched values
loading_phrase=DonManfred presents
Loading phrase info: Source Remote, DonManfred presents
Promocode info: Source Remote, PromoDeutschland
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
@Jack Cole
Please try this example and download the desugared file from HERE. Put the file in your additional libs folder.
Note to use your Firebaseproject Packagename and your json file for sure ;-)
 

Attachments

Last edited:

Jack Cole

Active Member
Licensed User
Manfred,

Thanks for working on this. When I try to run it, I get an error.

Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Generating R file. (1.48s)
Compiling generated Java code. (1.60s)
Convert byte code - optimized dex. Error
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/config/proto/Config;
But if I comment out #AdditionalJar: firebase-config-ds, it works fine. So maybe it's in good shape now?

Thanks,
Jack
 
Top