User3
User3

Reputation: 2535

How to load code into Android at runtime

I have an app which is almost 60mb on the market and after installation it takes upto 1 gb of memory.

I want to reduce the memory footprint of my application and hence I want to load certain modules based on user preference.

What I plan to do is host these packages remotely over a server and fetch them runtime so as to load code.

I dont have much of an idea of how far I can go with this. However my preliminary research has revealed the following ways:

1) Use dex loader - pros: Supported officially however does not help with loading activities / GUI (I know fragments are a subset of an Activity but GUI is not supported or is a pain in the A)

2) I am fiddling around with LuaJava and loading certain lua scripts (With GUI through reflection)from Assets however so far I am not able to load it runtime.

Is there anything else I am missing. Can I in real scenario even load scripts runtime?

Upvotes: 0

Views: 836

Answers (1)

sir mordred
sir mordred

Reputation: 161

Here https://github.com/sirmordred/JarClassLoader

You can load class object(so methods and variables) from compiled jar at runtime dynamically

Instructions are on README

Upvotes: 1

Related Questions