Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load Activities from external dex

Tags:

android

Is it possible to load activities from an external dex-file? I'm thinking of some plug-in style-architecture, where an application can be extended by downloading dex-files with activities and classes containing extra functionality.

I've managed to load and invoke methods on a class from a downloaded dex-file using DexClassLoader and reflection. But could I somehow use this technique to present download and present an Activity? Is it possible to register this new Activity programmatically so that I can invoke it using an Intent?

I know that it's possible (and the recommended way is) to install the other Activity through the normal procedure with an APK, and then load it from my main activity using Intents or simply update the installed application, but I want to extend my already installed application by downloading some extra classes and execute everything in the same VM, same sandbox.

Hm, let me know if you don't understand what I mean, cause this got a bit messy.. :)

like image 218
Joel Avatar asked Feb 22 '26 05:02

Joel


1 Answers

If you sign your APK using the same key, you can arrange so that all your applications to share UID, process, and VM. Don't try to dynamically load .dex files yourself, it gets messy real fast.

like image 148
Lie Ryan Avatar answered Feb 23 '26 18:02

Lie Ryan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!