Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

Crash using AndroidX with ProGuard enabled #163

Open
Syex opened this issue Oct 1, 2018 · 2 comments
Open

Crash using AndroidX with ProGuard enabled #163

Syex opened this issue Oct 1, 2018 · 2 comments

Comments

@Syex
Copy link
Contributor

Syex commented Oct 1, 2018

@passsy already added a workaround for the BackstackReader with AndroidX for #149.

However, with ProGuard enabled I encountered the following issue:

Fatal Exception: java.lang.NoSuchMethodError: No virtual method isInBackStack()Z in class Landroidx/e/a/d; or its super classes (declaration of 'androidx.e.a.d' appears in /data/app/de.memorian.gzg-Mcx2ZyPo55208bHcZq319Q==/base.apk)
       at androidx.core.app.BackstackReader.isInBackStack(BackstackReader.java:23)
       at net.grandcentrix.thirtyinch.TiFragment.isFragmentInBackstack(TiFragment.java:235)
       at net.grandcentrix.thirtyinch.TiFragment.net.grandcentrix.thirtyinch.internal.TiFragmentDelegate.onDestroy_afterSuper(TiFragment.java:10204)
       at androidx.fragment.app.FragmentManagerImpl.androidx.fragment.app.Fragment.performDestroy(FragmentManager.java:16699)

Adding a ProGuard rule
-keep class androidx.** { *; }
resp.
-keep class androidx.fragment.app.Fragment { *; }

fixed the problem.

We could add this ProGuard rule to the library ProGuard rules to avoid it for now.

@StefMa
Copy link
Contributor

StefMa commented Oct 11, 2018

Excluding everything (keep class androidx.** { *; }) of shrinking/obfuscating sounds a little bit aggressive to me... 🤔

@Syex
Copy link
Contributor Author

Syex commented Oct 11, 2018

The only fix I know so far.

Edit: Updated post, keeping the Fragment class is enough.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants