Android remote code loading

后端 未结 3 991
孤街浪徒
孤街浪徒 2020-12-07 11:08

I am developing a library for Android that requires frequent updates from a central server. I was thinking how nice it would be if my library could update itself -- or if I

3条回答
  •  猫巷女王i
    2020-12-07 11:27

    Indeed what you want is supported and works. DexClassLoader is not working as expected for me, but the following code works fine.

    DexFile df = new DexFile(new File("/data/app/my_downloaded_lib.apk"));
    ClassLoader cl = getClassLoader();
    Class clazz = df.loadClass("com/my/lib/MyClass", cl);
    

    About the market question, i don't see any issue with this, but you have to read the EULA to be sure.

提交回复
热议问题