question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamic Links crashes with il2cpp on Android due to Proguard stripping

See original GitHub issue

Platforms and SDKs

Unity editor version: 2019.1.11 f1 Firebase Unity SDK version: 6.2.0 Firebase plugins in use (Auth, Database, etc.): Auth, DynamicLinks Additional SDKs you are using (Facebook, AdMob, etc.): GoogleSignIn (Github link) Facebook, AdMob Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows Platform you are targeting (iOS, Android, and/or desktop): Android


Context: I’m using Firebase Dynamic Links Unity SDK to create dynamic referral links in my game. The script I wrote generates a long dynamic link from a DynamicLinkComponents instance.


Code:


DynamicLinkComponents dynamicLink = new DynamicLinkComponents(
                new Uri("https://flareupdigital.com/?invitedby=" + referralID),
                "https://flareupdigital.page.link"
);

Debug.Log(dynamicLink.LongDynamicLink); // Works fine with "Mono", Throws exception with "il2cpp"

Issue: When compiled with “il2cpp” scripting backend, dynamic link generation fails in device with the following error:

ApplicationException: internal::IsInitialized() at Firebase.DynamicLinks.FirebaseDynamicLinks.GetLongLinkInternal(Firebase.DynamicLinks.DynamicLinkComponentsInternal components)

(Full stack here - log.txt)


Important Notes: The script WORKS FINE in our devices (Google Pixel 2 XL, OnePlus 7, etc.) if compiled with the “Mono” scripting backend in Unity.


Additional References: This issue has been discussed before, but there was no solution posted or the solution does not work:

  1. Unable to generate Firebase dynamic link
  • Suggested “Force Resolve” in the PlayServiceResolver, but that did not work for me
  1. Firebase Dynamic Links Fail To Generate On Real Device
  • No solution posted

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:22 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
rlehmannJCcommented, Feb 12, 2020

Hey guys,

we found a way to resolve the issue! The problem was that proguard stripped out some dynamic link libraries (and also some google internal stuff).

ALL of the following proguard lines are REQUIRED to get it working: -keep,includedescriptorclasses public class com.google.firebase.dynamiclinks* { *; }

-keep class com.google.firebase** { *; } -keep class com.google.firebase.appinvite** { *; } -keep class com.google.firebase.dynamiclinks** { *; } -keep class com.google.firebase.dynamiclinks.FirebaseDynamicLinks** { *; } -keep class com.google.android.gms.internal** { *; } -keep class com.google.android.gms** { *; }

0reactions
chkuang-gcommented, Jul 15, 2022

Is this still happening to you guys with the latest SDK, ex. 9.2.0? Please comment and upvote if this is still relevant to you.

I think we might be able to do something for this in the editor tool. That is, adding proguard lines automatically.

I will change this to a FR since we never support this functionality before.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic Links crashes with il2cpp on Android due to ...
The problem was that proguard stripped out some dynamic link libraries (and also some google internal stuff). ALL of the following proguard ......
Read more >
Android IL2CPP Build crashes while select both arm64 and ...
Only select one of them(arm64 or armv7 single) would not crash, but when I check both of them, the app would crash before...
Read more >
Release build app crashes cause of proguard rules
May be you have problem because of proguard, to be sure just try by disabling minify in your release build type
Read more >
Firebase Unity SDK Release Notes
Crashlytics. (Android) Fixed an issue with symbols being stripped when using the tgz package. Cloud Firestore.
Read more >
Getting Started with ProGuard
In this Android tutorial, you'll learn how to strip down your app size by making use of ProGuard – an app shrinking and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found