0

I added navigation components into the project. All works fine under debug mode. But when generate the apk, it crashes directly after tap the icon.

So I modified minifyEnable to true under develop to see if any clue.

Then I came across the error:

Error inflating class androidx.fragment.app.FragmentContainerView

I checked the questions here: link1 and link2:

  1. The activity is

    class AppActivity : AppCompatActivity()

  2. in the nav-graph.xml contains app:startDestination.

  3. Added implementation 'androidx.fragment:fragment-ktx:1.3.2'

All above don't work. Am I on the right direction? Thanks for the help.

William Hu
  • 15,423
  • 11
  • 100
  • 121

1 Answers1

1

The problem is cased by the Safe Args which should not be shrinked. So put @Keep in front of the Parceable and Serializable solved the issue.

https://developer.android.com/guide/navigation/navigation-pass-data#proguard_considerations

William Hu
  • 15,423
  • 11
  • 100
  • 121