Monday, 27 June 2022

Firebase dynamic deeplink crash

I am following Add Firebase to your Android project documents to integrate the Firebase dynamic deeplink.

SplashActivity:

private fun fetchDeeplink() {
   Firebase.dynamicLinks
        .getDynamicLink(intent)
        .addOnSuccessListener { pendingDynamicLinkData ->
        // Get deep link from result (may be null if no link is found)
        var deepLink: Uri? = null
        if (pendingDynamicLinkData != null) {
            deepLink = pendingDynamicLinkData.link
            Log.v("Link", "${pendingDynamicLinkData.utmParameters}")
        }
        Log.v("Link", "$deepLink")
    }.addOnFailureListener {
        Log.v("Link", "getDynamicLink:onFailure", it)
    }
}

AndroidManifest:

       <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:host="example.com" />
            <data android:scheme="https" />

            <data android:host="example.com" />
            <data android:scheme="http" />
        </intent-filter>

I am getting below error in code:

java.lang.NoSuchFieldError: No static field NO_OPTIONS of type Lcom/google/android/gms/common/api/Api$ApiOptions$NoOptions; in class Lcom/google/android/gms/common/api/Api$ApiOptions; or its superclasses (declaration of 'com.google.android.gms.common.api.Api$ApiOptions' appears in /data/app/~~sCHnYmsdg5F0R898Jyet1g==/com.example.debug-z2gEREBnMSidGNbiYKX82A==/base.apk!classes19.dex)
    at com.google.firebase.dynamiclinks.internal.DynamicLinksApi.<init>(DynamicLinksApi.java:67)
    at com.google.firebase.dynamiclinks.internal.FirebaseDynamicLinksImpl.<init>(FirebaseDynamicLinksImpl.java:67)
    at com.google.firebase.dynamiclinks.internal.FirebaseDynamicLinkRegistrar.lambda$getComponents$0(FirebaseDynamicLinkRegistrar.java:50)
    at com.google.firebase.dynamiclinks.internal.FirebaseDynamicLinkRegistrar$$ExternalSyntheticLambda0.create(Unknown Source:0)
    at com.google.firebase.components.ComponentRuntime.lambda$discoverComponents$0$com-google-firebase-components-ComponentRuntime(ComponentRuntime.java:132)
    at com.google.firebase.components.ComponentRuntime$$ExternalSyntheticLambda1.get(Unknown Source:4)
    at com.google.firebase.components.Lazy.get(Lazy.java:53)
    at com.google.firebase.components.AbstractComponentContainer.get(AbstractComponentContainer.java:27)
    at com.google.firebase.components.ComponentRuntime.get(ComponentRuntime.java:45)
    at com.google.firebase.FirebaseApp.get(FirebaseApp.java:338)
    at com.google.firebase.dynamiclinks.FirebaseDynamicLinks.getInstance(FirebaseDynamicLinks.java:67)
    at com.google.firebase.dynamiclinks.FirebaseDynamicLinks.getInstance(FirebaseDynamicLinks.java:62)
    at com.example.SplashActivity.fetchDeeplink(SplashActivity.kt:140)
    at com.example.SplashActivity.onCreate(SplashActivity.kt:130)
    at android.app.Activity.performCreate(Activity.java:8290)
    at android.app.Activity.performCreate(Activity.java:8270)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4009)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4201)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at android.app.ActivityThread.main(ActivityThread.java:8663)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)


from Firebase dynamic deeplink crash

No comments:

Post a Comment