What can I use as an alternative to DexFile in Android?

Viewed 80
DexFile dexFile = new DexFile(path);
Enumeration<String> classNames = dexFile.entries();

The above code is the only way I am using DexFile. This has been deprecated and I want to future proof my code as much as possible. I can't find a working alternative without using an external library such as reflection, which I wish to avoid.

I already have a system to find and load the classes and methods I want, which works as it is. I just need a replacement for the two lines of code.

I have tried using ClassLoader.GetResources(path) and it always returns null regardless of the path I give it, and I've tried every way I can think of.

Can anyone point me in the right direction please.

1 Answers

You just want to download implementations of some interfaces/abstract classes, if you want to download all entries of classes on ClassPath. I can't imagine any other scenario, so You can implement IoC by using frameworks like Dagger or Hilt. I made answere here.

Related