Didn't find class on path: DexPathList (Dynamic Feature Module)

25 Views Asked by At

In the MainApplication I have override MainApplication: SplitCompatApplication()

In the MainActivity also registered SplitInstallStateUpdatedListener and tested the logic flow and seems that everything is working correct.

Note: The app contains also some other Dynamic Feature Modules and everything is also working correctly.

Ex. When I try to show a fragment from other dynamic feature modules everything is working correctly like in below code:

iperf = iperf ?: fm.fragmentFactory.instantiate(
                                    ClassLoader.getSystemClassLoader(),
                                    "com.******.app_advanced_tools_feature.fragments.iperf_feature"
                                ) as iperf_abstract
                                ft.add(R.id.fragment_container, iperf!!, "iperf")
                                ft.addToBackStack("iperf")
                                ft.commit()

The issue that I have is when adding another DFM and trying to show Activity instead of Fragment and it always fails with ClassNotFoundException

So, this code doesn't work:

val activity = ClassLoader.getSystemClassLoader().loadClass("com.*******.second_feature.activity.MainActivity")
                        startActivity(Intent(applicationContext, activity::class.java))

The DFM is found and loaded correctly from SplitInstall since it goes through

if (splitInstallManager.installedModules.contains("module_name")) {

    fun onSuccessfulLoad(moduleName: String, toolName: String)
}

Also, tried almost everything but nothing helped me. If anyone have any idea or maybe know any solution that would be great.

0

There are 0 best solutions below