Load DEX file dynamically on Android 5.0

后端 未结 2 1467
清酒与你
清酒与你 2020-12-10 03:29

Prior to Android 5.0 I was able to load DEX files dynamically using DexClassLoader and calling loadClass() method but with the latest Android version I get a

2条回答
  •  生来不讨喜
    2020-12-10 04:09

    It is the problem with making dex file. Change the command as below then will work in all versions of android.

    dx.bat --dex --output path/output.jar  path/input.jar
    

    The above method in windows will generate a .jar file with classes.dex file inside that jar file. The DexClassLoader is searching for classes.dex file inside, that is why it is throwing ClassNotFoundException

提交回复
热议问题