quickstart-android icon indicating copy to clipboard operation
quickstart-android copied to clipboard

Remote Config: NullPointerException: Attempt to read from field 'int com.google.android.gms.internal.zzaji$zzc.zzbTG' on a null object

Open cypressious opened this issue 10 years ago • 11 comments

I'm using the Genymotion emulator and since somewhere around last week, my app won't launch anymore when I use Remote Config. Everytime the app starts, I get the following stacktrace:

 java.lang.RuntimeException: Unable to start activity ComponentInfo{my.package.android/my.package.android.MainActivity}: java.lang.NullPointerException: Attempt to read from field 'int com.google.android.gms.internal.zzaji$zzc.zzbTG' on a null object reference
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
       at android.app.ActivityThread.access$800(ActivityThread.java:144)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5221)
       at java.lang.reflect.Method.invoke(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
    Caused by: java.lang.NullPointerException: Attempt to read from field 'int com.google.android.gms.internal.zzaji$zzc.zzbTG' on a null object reference
       at com.google.firebase.remoteconfig.FirebaseRemoteConfig.zza(Unknown Source)
       at com.google.firebase.remoteconfig.FirebaseRemoteConfig.zzbE(Unknown Source)
       at com.google.firebase.remoteconfig.FirebaseRemoteConfig.getInstance(Unknown Source)
       at my.package.android.logic.ConfigHelper.<init>(ConfigHelper.kt:16)
       at my.package.android.logic.ConfigHelper_Factory.get(ConfigHelper_Factory.java:12)
       at my.package.android.logic.ConfigHelper_Factory.get(ConfigHelper_Factory.java:6)
       at dagger.internal.ScopedProvider.get(ScopedProvider.java:46)
       at my.package.android.MainActivity_MembersInjector.injectMembers(MainActivity_MembersInjector.java:41)
       at my.package.android.MainActivity_MembersInjector.injectMembers(MainActivity_MembersInjector.java:11)
       at my.package.android.DaggerMyApplication_ApplicationComponent.inject(DaggerMyApplication_ApplicationComponent.java:552)
       at my.package.android.MainActivity.onCreate(MainActivity.kt:44)
       at android.app.Activity.performCreate(Activity.java:5933)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) 
       at android.app.ActivityThread.access$800(ActivityThread.java:144) 
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 
       at android.os.Handler.dispatchMessage(Handler.java:102) 
       at android.os.Looper.loop(Looper.java:135) 
       at android.app.ActivityThread.main(ActivityThread.java:5221) 
       at java.lang.reflect.Method.invoke(Native Method) 
       at java.lang.reflect.Method.invoke(Method.java:372) 

The emulator is running Android 5.0.

cypressious avatar Jun 15 '16 13:06 cypressious

Genymotion has no play services and therefore is expected not to work

On Wed, Jun 15, 2016, 16:43 Kirill Rakhman [email protected] wrote:

I'm using the Genymotion emulator and since somewhere around last week, my app won't launch anymore when I use Remote Config. Everytime the app starts, I get the following stacktrace:

java.lang.RuntimeException: Unable to start activity ComponentInfo{my.package.android/my.package.android.MainActivity}: java.lang.NullPointerException: Attempt to read from field 'int com.google.android.gms.internal.zzaji$zzc.zzbTG' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) at android.app.ActivityThread.access$800(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) Caused by: java.lang.NullPointerException: Attempt to read from field 'int com.google.android.gms.internal.zzaji$zzc.zzbTG' on a null object reference at com.google.firebase.remoteconfig.FirebaseRemoteConfig.zza(Unknown Source) at com.google.firebase.remoteconfig.FirebaseRemoteConfig.zzbE(Unknown Source) at com.google.firebase.remoteconfig.FirebaseRemoteConfig.getInstance(Unknown Source) at my.package.android.logic.ConfigHelper.(ConfigHelper.kt:16) at my.package.android.logic.ConfigHelper_Factory.get(ConfigHelper_Factory.java:12) at my.package.android.logic.ConfigHelper_Factory.get(ConfigHelper_Factory.java:6) at dagger.internal.ScopedProvider.get(ScopedProvider.java:46) at my.package.android.MainActivity_MembersInjector.injectMembers(MainActivity_MembersInjector.java:41) at my.package.android.MainActivity_MembersInjector.injectMembers(MainActivity_MembersInjector.java:11) at my.package.android.DaggerMyApplication_ApplicationComponent.inject(DaggerMyApplication_ApplicationComponent.java:552) at my.package.android.MainActivity.onCreate(MainActivity.kt:44) at android.app.Activity.performCreate(Activity.java:5933) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) at android.app.ActivityThread.access$800(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/firebase/quickstart-android/issues/51, or mute the thread https://github.com/notifications/unsubscribe/ACtEJph3bu05otUcSVmRtFIyu3hSS98gks5qMAFjgaJpZM4I2Xp9 .

yishai-glide avatar Jun 15 '16 13:06 yishai-glide

There is a well-known workaround for installing Play Services on Genymotion and it works for the regular Google Play Libraries like Maps, App Indexing and Auth. Besides, other Firebase services like Analytics, Messaging or Auth are working, too.

Actually, Genymotion is the only emulator you can currently use to test Firebase, because the official emulator images haven't received GMS 9.0.0.

cypressious avatar Jun 15 '16 13:06 cypressious

Unless you have a version greater than 9.x this is not going to work

On Wed, Jun 15, 2016, 16:46 Kirill Rakhman [email protected] wrote:

There is a well-known workaround for installing Play Services on Genymotion and it works for the regular Google Play Libraries like Maps, App Indexing and Auth. Besides, other Firebase services like Analytics, Messaging or Auth are working, too.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/firebase/quickstart-android/issues/51#issuecomment-226191648, or mute the thread https://github.com/notifications/unsubscribe/ACtEJo7LZhnz2SoLu8pRTp4iqS0K6XyTks5qMAIjgaJpZM4I2Xp9 .

yishai-glide avatar Jun 15 '16 13:06 yishai-glide

I have Google Play Services version 9.0.83 installed.

cypressious avatar Jun 15 '16 13:06 cypressious

This is happening in production. It is not exclusive to emulators! I had to try catch it! http://stackoverflow.com/questions/37748985/nullpointer-on-firebaseremoteconfig-getinstance?noredirect=1#comment63310992_37748985

cuchas avatar Jun 22 '16 20:06 cuchas

I believe this issue has been fixed in the new 9.2.0 version of the SDK which was just released a few hours ago.

@cypressious could you try to update your project to use the new SDK and see if this works? Note that you will need Google Play Services 9.2.x on your device. On a real device this should have been pushed over the air, on Genymotion I am not sure exactly how you get it but I assume your same workaround should work.

samtstern avatar Jun 27 '16 18:06 samtstern

This issue also happens to us in Production, with Play Services 9.2.56 (434).

Some affected devices: LGLS740, LGLS770, LGLS996, MotoE2, SM-G360P.

Here's the exception: "3:25:10.638 PM UTC+3 - June 29, 2016 initFirebaseRemoteConfig: java.lang.NullPointerException: Attempt to read from field 'int com.google.android.gms.internal.zzaji$zzc.zzbTG' on a null object"

eranpolo avatar Jun 29 '16 12:06 eranpolo

@eranpolo is your app compiled against the 9.2.0 SDK?

samtstern avatar Jun 30 '16 20:06 samtstern

No, we're compiled against 9.0.0. Our next version would be compiled against 9.2.0, we'll update once it's deployed.

eranpolo avatar Jul 03 '16 07:07 eranpolo

Closing this issue due to lack of activity. Feel free to open a new one if the issue persists.

kroikie avatar Jul 29 '16 18:07 kroikie

Just updating that using 9.2.0 solved the problem for us :)

eranpolo avatar Aug 21 '16 14:08 eranpolo