External dex load

Is it possible to load actions from an external dex file? I’m thinking of some stylistic plugin architecture where the application can be extended by loading dex files with actions and classes containing additional functions.

I managed to load and call methods in the class from the loaded dex file using DexClassLoader and reflection. But can I somehow use this technique to represent loading and representing Activity? Is it possible to register this new activity programmatically so that I can use it with Intent?

I know that it is possible (and recommended) to set another activity through a regular procedure using APK, and then load it from my main action using Intents or just update an installed application, but I want to expand my already installed application by downloading some additional classes and by doing everything in the same virtual machine, the same sandbox.

Hm, let me know if you do not understand what I mean because it is a little confused .. :)

+3
source share
2 answers

If you sign the APK using the same key, you can arrange for all your applications to share the UID, process, and virtual machine . Do not try to dynamically download .dex files yourself, it quickly becomes messy.

+2

createpackagecontext apk.

0

Source: https://habr.com/ru/post/1790716/


All Articles