Android Question FirebaseRemoteConfig Error initializing

desof

Well-Known Member
Licensed User
I'm using the FirebaseRemoteConfig 2.0.1 library and now updating everything from SDK Manager does not work for me anymore.
I get an error when trying to initialize on the first line
B4X:
cfg.Initialize("Config")          
            cfg.Defaults(CreateMap("app_version": 101, "bd_com_version": 53, "publicita_ctdad": 5, "publicita_folder": "popup", "publicita_frec": 5))
            cfg.fetch(-1)
the error it gives is this >>>
B4X:
(Exception) java.lang.Exception:  java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.remoteconfig.FirebaseRemoteConfig com.google.firebase.remoteconfig.RemoteConfigComponent.get(java.lang.String)' on a null object reference


How can i fix this?
 

DonManfred

Expert
Licensed User
How can i fix this?
Don´t know. Never used the lib for years.
Sounds like they changed the Api in some kind.

Maybe the lib needs an Update. But if so then i need to rewrite it to 100% as i lost the source in 2017 due to a HDD Crash.

I did found the source (had a backup of this lib).

Try the attached 2-02
 

Attachments

Last edited:

desof

Well-Known Member
Licensed User
Don´t know. Never used the lib for years.
Sounds like they changed the Api in some kind.

Maybe the lib needs an Update. But if so then i need to rewrite it to 100% as i lost the source in 2017 due to a HDD Crash.

I did found the source (had a backup of this lib).

Try the attached 2-02
Hello friend DonManfred, now with the update I successfully passed the line cfg.Initialize ("Config")
and I get an error in the next one that is this >>
B4X:
(Exception) java.lang.Exception:  java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.remoteconfig.FirebaseRemoteConfig com.google.firebase.remoteconfig.RemoteConfigComponent.get(java.lang.String)' on a null object reference
Is it possible that I am creating MAP badly?

So I am using >>
B4X:
Dim M As Map
            M.Initialize
            M=CreateMap("app_version": 101, "bd_com_version": 53, "popup", "publicita_frec": 5)
            cfg.Initialize("Config")           
            cfg.setDefaults2(m,"Config")
            cfg.fetch2(1)
 

GMan

Well-Known Member
Licensed User
AFAIK is a map a combination of a keyword and the value IN ONE LINE each
 

desof

Well-Known Member
Licensed User
AFAIK is a map a combination of a keyword and the value IN ONE LINE each
it has nothing to do with his answer. I know how to use maps there is only one error in the transcripts reduced to this forum. THE ERROR EXISTS!
 

CGP

Member
Licensed User
I have the same problem too.

B4X:
java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.remoteconfig.FirebaseRemoteConfig com.google.firebase.remoteconfig.zzg.zzbd(java.lang.String)' on a null object reference
    at com.google.firebase.remoteconfig.FirebaseRemoteConfig.getInstance(Unknown Source:3)
    at de.donmanfred.FirebaseRemoteConfigwrapper.setDefaults(FirebaseRemoteConfigwrapper.java:107)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
    at b4a.donmanfred.GCM.starter.handleStart(starter.java:100)
    at b4a.donmanfred.GCM.starter.access$000(starter.java:8)
    at b4a.donmanfred.GCM.starter$1.run(starter.java:71)
    at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.onStartCommand(ServiceHelper.java:235)
    at b4a.donmanfred.GCM.starter.onStartCommand(starter.java:69)
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3513)
    at android.app.ActivityThread.-wrap20(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1721)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:173)
    at android.app.ActivityThread.main(ActivityThread.java:6651)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:822)
 

desof

Well-Known Member
Licensed User
It seems that we are very few who use this, do not we?
Or only we have problems at least!
I had to modify my application significantly, removing an important function for not being able to access Firebase anymore. Very unfortunate
 

Jack Cole

Active Member
Licensed User
I am having this problem too. I tried the 2.02 and 2.01. I get errors elsewhere in the code. It gives an error on cfg.isInitialized -- unknown member.

The following line also gives an error:
cfg.Defaults(CreateMap("RB_Launch_Count": 3, "loading_phrase": "Hallo world!"))

Property: Defaults is writeonly.

Anyway, I get this error after commenting out the above.

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

Please post the Java code. I'm no Java expert, but I will take a look.
 

DonManfred

Expert
Licensed User
I´ve updated the Library to v2.5

- It now includes Instructions on how to setup the Manifest to use RemoteConfig.
Google has changed the Manifestintegration. A new Snippet is needed.
I´ve added the new Snippet to the library like i had done it with Firestore (not the same but similar).
 
Last edited:

arastoo

Active Member
Licensed User
I´ve updated the Library to v2.5

- It now includes Instructions on how to setup the Manifest to use RemoteConfig.
Google has changed the Manifestintegration. A new Snippet is needed.
I´ve added the new Snippet to the library like i had done it with Firestore (not the same but similar).
Hi DonManfred

I recently installed version B4A 10.2 beta
Before these changes, the library worked good, but now it crash with the following error.

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
b4x ver 10.2 beta
lib ver 2.52


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
Initialize OneSignal
 
Top