Android Question FirebaseRemoteConfig Error

SMOOTSARA

Active Member
Licensed User
Hello friends


I'm using the FirebaseRemoteConfig 2.52 library and now updating everything from SDK Manager does not work for me anymore.
I get an error when trying to initialize.
It worked properly before the update sdk and B4A ver 10.2 beta

B4X:
(NullPointerException) java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.remoteconfig.FirebaseRemoteConfig com.google.firebase.remoteconfig.RemoteConfigComponent.getDefault()' on a null object reference


and

B4X:
*** Service (starter) Create ***
remote_host_initialize (B4A line: 31)
cfg.Initialize("Config")
java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.remoteconfig.FirebaseRemoteConfig com.google.firebase.remoteconfig.RemoteConfigComponent.getDefault()' on a null object reference
    at com.google.firebase.remoteconfig.FirebaseRemoteConfig.getInstance(FirebaseRemoteConfig.java:87)
    at com.google.firebase.remoteconfig.FirebaseRemoteConfig.getInstance(FirebaseRemoteConfig.java:81)
    at de.donmanfred.FirebaseRemoteConfigwrapper.Initialize(FirebaseRemoteConfigwrapper.java:36)
    at xxxx.xxx.com.remote_host._initialize(remote_host.java:696)
    at xxxx.xxx.com.starter._service_create(starter.java:404)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at xxxx.xxx.com.starter.onCreate(starter.java:56)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:3953)
    at android.app.ActivityThread.access$1500(ActivityThread.java:219)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1875)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
java.lang.RuntimeException: Unable to create service xxxx.xxx.com.starter: java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.remoteconfig.FirebaseRemoteConfig com.google.firebase.remoteconfig.RemoteConfigComponent.getDefault()' on a null object reference
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:3965)
    at android.app.ActivityThread.access$1500(ActivityThread.java:219)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1875)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.remoteconfig.FirebaseRemoteConfig com.google.firebase.remoteconfig.RemoteConfigComponent.getDefault()' on a null object reference
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:250)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at xxxx.xxx.com.starter.onCreate(starter.java:56)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:3953)
    ... 8 more
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.remoteconfig.FirebaseRemoteConfig com.google.firebase.remoteconfig.RemoteConfigComponent.getDefault()' on a null object reference
    at com.google.firebase.remoteconfig.FirebaseRemoteConfig.getInstance(FirebaseRemoteConfig.java:87)
    at com.google.firebase.remoteconfig.FirebaseRemoteConfig.getInstance(FirebaseRemoteConfig.java:81)
    at de.donmanfred.FirebaseRemoteConfigwrapper.Initialize(FirebaseRemoteConfigwrapper.java:36)
    at xxxx.xxx.com.remote_host._initialize(remote_host.java:696)
    at xxxx.xxx.com.starter._service_create(starter.java:404)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    ... 11 more

lib : Firebase RemoteConfig - DonManfred
lib ver : 2.52
B4A ver : 10.2 Beta
sdk :full update

manifest :
B4X:
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)


main :
B4X:
#AdditionalJar: com.google.firebase:firebase-core
#AdditionalJar: com.google.firebase:firebase-config


configuration:
jdk-11.0.1
android-30

1599717506930.png
 

DonManfred

Expert
Licensed User
can you write the full list of dependencies?
i´m not sure about what all is needed with the newest versions.

I tried to update Firebase Manifest snippet from Analytics snippet and the AAR that was generated by Android Studio running the Quickstart Config example.
But that did not work.
I´m not sure how to interpret the error i found in the unfiltered or what is missing :-(

This is the error using my manifestcode in the lib.

Class com.google.firebase.firestore.FirestoreRegistrar is not an found.
java.lang.ClassNotFoundException: com.google.firebase.firestore.FirestoreRegistrar
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at java.lang.Class.forName(Class.java:379)
at com.google.firebase.components.ComponentDiscovery.instantiate(com.google.firebase:firebase-components@@16.0.0:80)
at com.google.firebase.components.ComponentDiscovery.discover(com.google.firebase:firebase-components@@16.0.0:73)
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:419)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:300)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:268)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:253)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2113)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2087)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:7613)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7158)
at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7021)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6989)
at android.app.ActivityThread.access$1600(ActivityThread.java:272)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2055)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8016)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
Caused by: java.lang.ClassNotFoundException: com.google.firebase.firestore.FirestoreRegistrar
... 25 more
Class com.google.firebase.database.DatabaseRegistrar is not an found.
java.lang.ClassNotFoundException: com.google.firebase.database.DatabaseRegistrar
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at java.lang.Class.forName(Class.java:379)
at com.google.firebase.components.ComponentDiscovery.instantiate(com.google.firebase:firebase-components@@16.0.0:80)
at com.google.firebase.components.ComponentDiscovery.discover(com.google.firebase:firebase-components@@16.0.0:73)
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:419)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:300)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:268)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:253)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2113)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2087)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:7613)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7158)
at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7021)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6989)
at android.app.ActivityThread.access$1600(ActivityThread.java:272)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2055)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8016)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
Caused by: java.lang.ClassNotFoundException: com.google.firebase.database.DatabaseRegistrar
... 25 more
Class com.google.firebase.storage.StorageRegistrar is not an found.
java.lang.ClassNotFoundException: com.google.firebase.storage.StorageRegistrar
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at java.lang.Class.forName(Class.java:379)
at com.google.firebase.components.ComponentDiscovery.instantiate(com.google.firebase:firebase-components@@16.0.0:80)
at com.google.firebase.components.ComponentDiscovery.discover(com.google.firebase:firebase-components@@16.0.0:73)
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:419)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:300)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:268)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:253)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2113)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2087)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:7613)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7158)
at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7021)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6989)
at android.app.ActivityThread.access$1600(ActivityThread.java:272)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2055)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8016)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
Caused by: java.lang.ClassNotFoundException: com.google.firebase.storage.StorageRegistrar
... 25 more
Shutting down VM
FATAL EXCEPTION: main
Process: de.donmanfred.gcm, PID: 19400
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: com.google.firebase.components.MissingDependencyException: Unsatisfied dependency for component Component<[class com.google.firebase.messaging.FirebaseMessaging]>{1, type=0, deps=[Dependency{anInterface=class com.google.firebase.FirebaseApp, type=required, direct=true}, Dependency{anInterface=interface com.google.android.datatransport.TransportFactory, type=optional, direct=true}, Dependency{anInterface=interface com.google.firebase.heartbeatinfo.HeartBeatInfo, type=required, direct=true}, Dependency{anInterface=class com.google.firebase.iid.FirebaseInstanceId, type=required, direct=true}, Dependency{anInterface=interface com.google.firebase.platforminfo.UserAgentPublisher, type=required, direct=true}, Dependency{anInterface=interface com.google.firebase.installations.FirebaseInstallationsApi, type=required, direct=true}]}: interface com.google.firebase.installations.FirebaseInstallationsApi
at android.app.ActivityThread.installProvider(ActivityThread.java:7618)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7158)
at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7021)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6989)
at android.app.ActivityThread.access$1600(ActivityThread.java:272)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2055)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8016)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
Caused by: com.google.firebase.components.MissingDependencyException: Unsatisfied dependency for component Component<[class com.google.firebase.messaging.FirebaseMessaging]>{1, type=0, deps=[Dependency{anInterface=class com.google.firebase.FirebaseApp, type=required, direct=true}, Dependency{anInterface=interface com.google.android.datatransport.TransportFactory, type=optional, direct=true}, Dependency{anInterface=interface com.google.firebase.heartbeatinfo.HeartBeatInfo, type=required, direct=true}, Dependency{anInterface=class com.google.firebase.iid.FirebaseInstanceId, type=required, direct=true}, Dependency{anInterface=interface com.google.firebase.platforminfo.UserAgentPublisher, type=required, direct=true}, Dependency{anInterface=interface com.google.firebase.installations.FirebaseInstallationsApi, type=required, direct=true}]}: interface com.google.firebase.installations.FirebaseInstallationsApi
at com.google.firebase.components.ComponentRuntime.validateDependencies(com.google.firebase:firebase-components@@16.0.0:170)
at com.google.firebase.components.ComponentRuntime.processInstanceComponents(com.google.firebase:firebase-components@@16.0.0:89)
at com.google.firebase.components.ComponentRuntime.<init>(com.google.firebase:firebase-components@@16.0.0:73)
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:433)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:300)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:268)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:253)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2113)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2087)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:7613)
... 11 more

firebase.b4x_excluded (adapted from anylytics and added based on AS Project generated Manifest)
CreateResourceFromFile("google-services", "google-services.json")
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.WAKE_LOCK)
AddPermission(com.google.android.c2dm.permission.RECEIVE)
AddPermission(${applicationId}.permission.C2D_MESSAGE)
AddPermission(com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE)
AddManifestText( <permission android:name="${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature" />)
AddApplicationText(
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="true"
android:exported="false" >
</receiver>

<service
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="true"
android:exported="false" />

<receiver
android:name="com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver"
android:enabled="true"
android:exported="true"
android:permission="android.permission.INSTALL_PACKAGES" >
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.measurement.AppMeasurementJobService"
android:enabled="true"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />

<service android:name="com.google.firebase.components.ComponentDiscoveryService" android:directBootAware="true" >
<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.storage.StorageRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.firestore.FirestoreRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar"/>

<meta-data
android:name="com.google.firebase.components:com.google.firebase.database.DatabaseRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar"/>
<meta-data
android:name="com.google.firebase.components:com.google.firebase.messaging.FirebaseMessagingRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.installations.FirebaseInstallationsRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.crashlytics.CrashlyticsRegistrar"
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.remoteconfig.ktx.FirebaseRemoteConfigKtxRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
<meta-data android:name="com.google.firebase.components:com.google.firebase.ktx.FirebaseCommonKtxRegistrar" 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>
<provider
android:authorities="${applicationId}.firebaseinitprovider"
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:exported="false"
android:directBootAware="true"
android:initOrder="100" />

<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
android:exported="false" />
<provider android:name="com.google.firebase.provider.FirebaseInitProvider" android:exported="false" android:authorities="com.google.samples.quickstart.config.firebaseinitprovider" android:initOrder="100"/>
<receiver android:name="com.google.android.gms.measurement.AppMeasurementReceiver" android:enabled="true" android:exported="false"/>
<service android:name="com.google.android.gms.measurement.AppMeasurementService" android:enabled="true" android:exported="false"/>
<service android:name="com.google.android.gms.measurement.AppMeasurementJobService" android:permission="android.permission.BIND_JOB_SERVICE" android:enabled="true" android:exported="false"/>

<service
android:name="com.google.firebase.iid.FirebaseInstanceIdService"
android:exported="true">
<intent-filter android:priority="-500">
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
)
 
Upvote 0

SMOOTSARA

Active Member
Licensed User
Hi Erel and DonManfred
This library is practical and important
Do you have a plan to solve this problem?
Do you think I should reduce the SDK version to fix this error?
I can start app updates with a lower SDK version of the app.
Thank you for your cooperation.
 
Upvote 0
Top