During the implementation of the passing parameter solution, in navigation between modules, I came across a serialization error. Deeplinks, as far as I know, accepts custom argument types, which are Parcelables or Serializable.
Im using newest version of navigation 2.2.0
Error message:
java.lang.UnsupportedOperationException: Parcelables don't support default values.
Am I doing something wrong or this is still under development?
Here is short example:
<fragment
android:id="@+id/sampleFragment"
android:name="com.testapp.app.samples.navigation.SampleFragment"
android:label="SampleFragment">
<argument
android:name="Args"
app:argType="com.testapp.navigation.SampleArgs" />
<deepLink app:uri="app://app/samples/navigation/SampleFragment?Args={Args}"/>
</fragment>
@Parcelize
@Keep data class SampleArgs(
val text: String
) : NavArgs, Parcelable
val x = SampleArgs("TEST")
val uri = Uri.parse("app://app/samples/navigation/SampleFragment?Args=$x")
navController.navigate(uri)
I found something similar here Android Parcelable don't support default values App Crash
It's my first post on stack, so please be gentle :)
EDIT
Here is answer: