I\'m trying to transition from using a FrameLayout
to using FragmentContainerView
and from the tutorials I\'ve seen, it should be pretty easy. Howe
That's in androidx.fragment
1.2.0 or higher:
implementation "androidx.fragment:fragment:1.2.0"
Thanks to @Salam El-Banna and his link, I found that in case an application crashes in release
build we should add in proguard-rules.pro
(one or two lines, depending on android:name
in <FragmentContainerView>
:
#-------------------------------------------------
# JetPack Navigation
# This fixes:
# Caused by: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment androidx.navigation.fragment.NavHostFragment: make sure class name exists
# Caused by: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists
#-------------------------------------------------
-keepnames class androidx.navigation.fragment.NavHostFragment
-keepnames class com.google.android.gms.maps.SupportMapFragment
You won't need implementation 'androidx.fragment:fragment:1.2.5'
if your applicatin crashes in release
build.