Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Firebase version upgrading

I had an app using Firebase and GMS service with version 11.8.0 for 2 years and now, I want to upgrade to latest version is 17.0.0. The dependencies following by below in gradle:

Before upgrade:

implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.google.android.gms:play-services-base:11.8.0'
implementation 'com.google.firebase:firebase-invites:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-config:11.8.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'

After upgrade:

implementation 'com.google.firebase:firebase-analytics:17.2.3'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-base:17.1.0'
implementation 'com.google.firebase:firebase-invites:17.0.0'
implementation 'com.google.firebase:firebase-messaging:20.1.1'
implementation 'com.google.firebase:firebase-config:19.1.2'
implementation 'com.google.android.gms:play-services-maps:17.0.0'

And modify code from:

    public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService {

        @Override
        public void onTokenRefresh() {
            //Getting registration token
            String token = FirebaseInstanceId.getInstance().getToken();
            // Save token
        }
    }

To

public class MyFirebaseInstanceIDService extends FirebaseMessagingService {

    @Override
    public void onNewToken(@NonNull String s) {
        super.onNewToken(s);
        // Save token
    }
}

And in Manifest I keep register service as below:

<service android:name=".notification.MyFirebaseInstanceIDService">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>

Everything else I setup before is no change. But when build and run I take an error with below stacktrace:

2020-03-12 11:38:29.225 26475-26543/com.example E/FirebaseInstanceId: Topic sync or token retrieval failed on hard failure exceptions: FIS_AUTH_ERROR. Won't retry the operation.
2020-03-12 11:38:29.460 26475-26550/com.example E/FirebaseInstanceId: Failed to get FIS auth token
    java.util.concurrent.ExecutionException: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.android.gms.tasks.Tasks.zzb(Unknown Source:61)
        at com.google.android.gms.tasks.Tasks.await(Unknown Source:23)
        at com.google.firebase.iid.zzs.zzb(com.google.firebase:firebase-iid@@20.1.0:54)
        at com.google.firebase.iid.zzs.zza(com.google.firebase:firebase-iid@@20.1.0:89)
        at com.google.firebase.iid.zzv.run(Unknown Source:12)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.firebase.installations.FirebaseInstallations.doRegistrationInternal(com.google.firebase:firebase-installations@@16.0.0:333)
        at com.google.firebase.installations.FirebaseInstallations.doGetId(com.google.firebase:firebase-installations@@16.0.0:280)
        at com.google.firebase.installations.FirebaseInstallations.access$lambda$0(Unknown Source:0)
        at com.google.firebase.installations.FirebaseInstallations$$Lambda$1.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919) 

After looking for solution on google, i found something like this: https://firebase.google.com/support/release-notes/android#2020-03-03

Then I go to my firebase console and enable Firebase Installation but nothing change. So can someone help me find out the way to resolve this issue? Many thank to all!

like image 277
Shaw Avatar asked Mar 12 '20 05:03

Shaw


People also ask

How do I change Firebase version?

firebase -V So you can basically run npm i -g firebase-tools to update the version of your firebase-tools installation to the latest version.

What is current Firebase version?

9.10.0 • Public • Published 11 days ago. 26 Dependencies. 3,619 Dependents. 3,043 Versions.

How do I check my Firebase version?

Run firebase tools --version to check version. And as per the prompt, run npm install -g firebase-tools to update. You're right.

What is Web version 9 modular?

There are two types of libraries available for Firebase Web SDK version 9: Modular - a new API surface designed to facilitate tree-shaking (removal of unused code) to make your web app as small and fast as possible.


1 Answers

change firebase-messaging version to 20.1.0

implementation 'com.google.firebase:firebase-messaging:20.1.0'
like image 180
Nensi Kasundra Avatar answered Oct 11 '22 14:10

Nensi Kasundra