Lovekush Vishwakarma
Lovekush Vishwakarma

Reputation: 3169

Firebase API initialization failure after renaming package name

I am getting FirebaseApp: Firebase API initialisation failure. error after renaming application package name, but with the original package name it is working fine

I have created new firebase app for new package as well as using new google-json file.

error log:

09-07 17:39:56.940 10181-10181/com.upliftapp D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
09-07 17:39:56.952 10181-10181/com.upliftapp E/FirebaseApp: Firebase API initialization failure.
    java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.google.firebase.FirebaseApp.zza(SourceFile:739)
        at com.google.firebase.FirebaseApp.zze(SourceFile:707)
        at com.google.firebase.FirebaseApp.initializeApp(SourceFile:328)
        at com.google.firebase.FirebaseApp.initializeApp(SourceFile:294)
        at com.google.firebase.FirebaseApp.initializeApp(SourceFile:281)
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1917)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1892)
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31)
        at android.app.ActivityThread.installProvider(ActivityThread.java:6239)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
        at android.app.ActivityThread.-wrap1(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zztv;
        at com.google.firebase.crash.internal.config.flag.Flags.<clinit>(Unknown Source:10)
        at com.google.firebase.crash.internal.config.flag.Flags.initialize(Unknown Source:0)
        at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source:4)
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.google.firebase.FirebaseApp.zza(SourceFile:739) 
        at com.google.firebase.FirebaseApp.zze(SourceFile:707) 
        at com.google.firebase.FirebaseApp.initializeApp(SourceFile:328) 
        at com.google.firebase.FirebaseApp.initializeApp(SourceFile:294) 
        at com.google.firebase.FirebaseApp.initializeApp(SourceFile:281) 
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37) 
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1917) 
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1892) 
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31) 
        at android.app.ActivityThread.installProvider(ActivityThread.java:6239) 
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805) 
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722) 
        at android.app.ActivityThread.-wrap1(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6494) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
09-07 17:39:56.953 10181-10181/com.upliftapp E/FirebaseApp: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.internal.zztv" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/base.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_dependencies_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_0_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_1_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_2_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_3_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_4_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_5_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_6_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_7_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_8_apk.apk", zip file "/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/base.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_dependencies_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_0_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_1_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_2_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_3_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_4_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_5_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_6_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_7_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_8_apk.apk!/lib/x86, /data/app/com.upliftapp-loT5KzpsPyXgUB1ROEaJ7w==/split_lib_slice_9_apk.apk!/lib/x86, /system/lib, /vendor/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
            ... 24 more
09-07 17:39:56.991 10181-10181/com.upliftapp V/FA: Registered activity lifecycle callback
09-07 17:39:56.993 10181-10181/com.upliftapp I/FirebaseInitProvider: FirebaseApp initialization successful
09-07 17:39:57.040 10181-10181/com.upliftapp E/com.facebook.internal.AttributionIdentifiers: getAttributionIdentifiers should not be called from the main thread
09-07 17:39:57.055 10181-10198/com.upliftapp I/zygote: Background concurrent copying GC freed 13187(4MB) AllocSpace objects, 3(56KB) LOS objects, 52% free, 1392KB/2MB, paused 329us total 107.573ms
09-07 17:39:57.094 10181-10216/com.upliftapp D/NetworkSecurityConfig: No Network Security Config specified, using platform default
09-07 17:39:57.158 10181-10215/com.upliftapp V/FA: Collection enabled
    App package, google app id: com.upliftapp, 1:456357737763:android:898ccf45fd84a88b
09-07 17:39:57.158 10181-10215/com.upliftapp I/FA: App measurement is starting up, version: 12451
    To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
    To enable faster debug mode event logging run:
      adb shell setprop debug.firebase.analytics.app com.upliftapp
09-07 17:39:57.158 10181-10215/com.upliftapp D/FA: Debug-level message logging enabled
09-07 17:39:57.176 10181-10215/com.upliftapp V/FA: Connecting to remote service
09-07 17:39:57.195 10181-10215/com.upliftapp V/FA: Connection attempt already in progress
09-07 17:40:27.011 10181-10212/com.upliftapp E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE
09-07 17:40:34.157 10181-10192/com.upliftapp I/zygote: Thread[3,tid=10192,WaitingInMainSignalCatcherLoop,Thread*=0xe3059c00,peer=0x16440ad0,"Signal Catcher"]: reacting to signal 3
09-07 17:40:34.183 10181-10192/com.upliftapp I/zygote: Wrote stack traces to '[tombstoned]'

this is the log i am getting.

Upvotes: 0

Views: 966

Answers (1)

sebasira
sebasira

Reputation: 1834

When you first connect your Android App to your Firebase App to enable the FCM a file named google-services.json was obtained. That file contains the package name of your app and has the information needed to connect to Firebase.

If you've changed the package name, go open and edit that file with the new package name. Or go to the Firebase Console and get a new google-services.json file with the correct package name.

That's why old one work and new does not

Upvotes: 1

Related Questions