2

In Documentation mentioned

Access code and resources from installed modules

& there is a function to load native library.

SplitInstallHelper.loadLibrary(newContext, “my-cpp-lib”);

But How can I access Java/Kotlin Class Or Java Library from Installed Dynamic Feature Module?

I have checked Call dynamic feature code from base module but there is no solution.

Thanks In Advance

Elias Fazel
  • 2,093
  • 16
  • 20

1 Answers1

0

You can load java/kotlin class by

Class cls = Class.forname("com.example.package");

once you are done with the dynamic feature module installation. Then, you can instantiate using

Object obj = cls.newInstance();

Alternatively, you can have an abstract class of com.example.package class e.g. ExampleAbstract.

The final code might look like

ExampleAbstract obj = cls.newInstance();