airbnb / DeepLinkDispatch

A simple, annotation-based library for making deep link handling better on Android
http://nerds.airbnb.com/deeplinkdispatch/
4.37k stars 407 forks source link

Migration to androidX #302

Open ikermart opened 3 years ago

ikermart commented 3 years ago

Previous situation, all the deeplinks working Deeplink Version: 3.1.1 My project using Android Support : v7

After upgrading my entire project to androidX sometimes crashed, see below: Deeplink Version: 5.2.0 My project now using androidX

Started to throw this crashes:

Exception: java.lang.IllegalArgumentException android.os.Parcel.nativeAppendFrom (Parcel.java) android.content.Intent.getExtras (Intent.java:5387) com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate.createResult (BaseDeepLinkDelegate.java:170) com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate.dispatchFrom (BaseDeepLinkDelegate.java:121) com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate.dispatchFrom (BaseDeepLinkDelegate.java:102)


@DeepLinkHandler(AppDeepLinkModule.class)
public class HandlerDeepLinkActivity extends Activity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        try{
            DeepLinkDelegate deepLinkDelegate = new DeepLinkDelegate(new AppDeepLinkModuleRegistry());
            deepLinkDelegate.dispatchFrom(this);
            finish();
        }catch (Exception e){
            FirebaseCrashlytics.getInstance().recordException(e);
            sendFailedAnswer();
        }

    }

**AndroidManifest.xml**
``
<activity  android:name=".deeplink.HandlerDeepLinkActivity"
            android:launchMode="singleInstance"
            android:theme="@android:style/Theme.NoDisplay">
            <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="paymnt"
                    android:scheme="txtxtx" />
            </intent-filter>
        </activity>
rossbacher commented 3 years ago

I'd debug if there is anything funky in the intent that is getting processed here. From the code it looks like the a simple .getExtras() call on the incoming intent is causing this and I'm pretty sure that is not caused by this lib in any way.

ikermart commented 2 years ago

@rossbacher thank you for your comment, it´s so weird, but something related with the migration to AndroidX is causing that randomly unmarshalling the bundle crash the application. There is a related bug https://cs.android.com/android/_/android/platform/frameworks/base/+/694753465b577509cecba33a90fb7cb6d50f5533 that in Android7 and above resolves this issue. The bad new is that my project only works for specifically hardware running Android5.1