yashovardhan99 / HealersDiary

Healers Diary - an android app for healers to keep track of their patients and help in instant billing. The app is currently in development.
https://play.google.com/store/apps/details?id=com.yashovardhan99.healersdiary&utm_source=github&utm_campaign=github&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1
Apache License 2.0
8 stars 0 forks source link

FragmentContainerView crash in release builds #20

Closed yashovardhan99 closed 3 years ago

yashovardhan99 commented 3 years ago

This is happening only in release builds. CreateNewActivity crashes when launched from any top level destination but opens fine when opened with a patient id in the uri.

Crash logs (all linked for the same crash):-

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.yashovardhan99.healersdiary/com.yashovardhan99.healersdiary.create.CreateNewActivity}: android.view.InflateException: Binary XML file line #7 in com.yashovardhan99.healersdiary:layout/activity_create_new: Binary XML file line #7 in com.yashovardhan99.healersdiary:layout/activity_create_new: Error inflating class androidx.fragment.app.FragmentContainerView
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3375)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3514)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
--- Truncated ---
Caused by android.view.InflateException: Binary XML file line #7 in com.yashovardhan99.healersdiary:layout/activity_create_new: Binary XML file line #7 in com.yashovardhan99.healersdiary:layout/activity_create_new: Error inflating class androidx.fragment.app.FragmentContainerView
Caused by android.view.InflateException: Binary XML file line #7 in com.yashovardhan99.healersdiary:layout/activity_create_new: Error inflating class androidx.fragment.app.FragmentContainerView

And the most strange one:-

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.endsWith(java.lang.String)' on a null object reference
       at androidx.navigation.NavType$4.parseValue(NavType.java:2)
       at androidx.navigation.NavType$4.parseValue(NavType.java)
       at androidx.navigation.NavType.parseAndPut(NavType.java)
       at androidx.navigation.NavDeepLink.parseArgument(NavDeepLink.java:6)
       at androidx.navigation.NavDeepLink.getMatchingArguments(NavDeepLink.java:195)
       at androidx.navigation.NavDestination.matchDeepLink(NavDestination.java:33)
--- Truncated ---
       at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:23)
       at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:4)
       at com.yashovardhan99.healersdiary.create.CreateNewActivity.onCreate(CreateNewActivity.java:6)
       at android.app.Activity.performCreate(Activity.java:7815)
       at android.app.Activity.performCreate(Activity.java:7804)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1325)
--- Truncated ---
yashovardhan99 commented 3 years ago

I have personally looked through the code but can't find the cause of the bug at all. Plus this is only happening in release builds shared through play store internal testing or closed track.

TODO:-

Could be related to proguard but a null pointer is really strange.

yashovardhan99 commented 3 years ago

Who would have thought deep links were the root of this problem!

yashovardhan99 commented 3 years ago

Just as a reference, it was actually my fault. I reported this issue to Google and turns out I missed a couple arguments in the deep link. Issue Tracker