Com.google.android.gms.common.api.ApiException when executing shorturl

I am using dynamic firebase links when I try to getShortLink fails with FATAL EXCEPTION called com.google.android.gms.common.api.ApiException please help me Here is my code

private void buildReferralLink() {
    //https://j8b99.app.goo.gl/
    String domain = "j8b99" + ".app.goo.gl";

    DynamicLink.Builder builder = FirebaseDynamicLinks.getInstance()
            .createDynamicLink()
            .setDynamicLinkDomain(domain)
            .setAndroidParameters(new DynamicLink.AndroidParameters.Builder()
                    .setMinimumVersion(BuildConfig.VERSION_CODE)
                    .build())
            .setLink(Uri.parse("https://play.google.com/store/apps/details?id=com.games4playstore.aroundyou"));

    builder.buildShortDynamicLink().addOnCompleteListener(this, new OnCompleteListener<ShortDynamicLink>() {
        @Override
        public void onComplete(@NonNull Task<ShortDynamicLink> task) {
            Uri shortLink = task.getResult().getShortLink();
            Log.e("test", "ShortLink: " + shortLink);
        }
    });
}

      

Here is my crash report

07-28 17:19:22.526 21231-21231/com.games4playstore.aroundyou E/AndroidRuntime: FATAL EXCEPTION: main
                                                                           Process: com.games4playstore.aroundyou, PID: 21231
                                                                           com.google.android.gms.tasks.RuntimeExecutionException: com.google.android.gms.common.api.ApiException
                                                                               at com.google.android.gms.tasks.zzn.getResult(Unknown Source)
                                                                               at com.games4playstore.aroundyou.MainActivity$3.onComplete(MainActivity.java:160)
                                                                               at com.google.android.gms.tasks.zzf.run(Unknown Source)
                                                                               at android.os.Handler.handleCallback(Handler.java:739)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                               at android.os.Looper.loop(Looper.java:145)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:6946)
                                                                               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:1404)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
                                                                            Caused by: com.google.android.gms.common.api.ApiException
                                                                               at com.google.android.gms.internal.zzbeq.zza(Unknown Source)
                                                                               at com.google.android.gms.internal.zg.zza(Unknown Source)
                                                                               at com.google.android.gms.internal.zl.onTransact(Unknown Source)
                                                                               at android.os.Binder.execTransact(Binder.java:446)

      

+3


source to share


2 answers


This was a server side issue with Dynamic Links on Android - it has been resolved and a fix should roll out soon.



+5


source


I am getting the same error. The code worked fine this week.

As per this link, an exception is thrown by the Task when the call to Google Play services failed. My first thought was to make sure I was referencing the latest builds (which appears to be 11.0.4 at the time of this writing) in my Gradle file, but that didn't matter.



The error does not show any additional information other than the ApiException. I have followed the steps to set up Firebase Dynamic Link again, but I don't see anything strange. Then I will try to find out if there are any problems with Google Play services.

As I said, my code (similar to yours) created good links two days ago. Very strange...

+2


source







All Articles