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 could just release a bootstrap library that downloads the target library when the app is installed.
I see this class in 1.5 called “DexClassLoader” but there seems to be precious little on the web besides the API docs. Has anyone used this successfully for the scenario which I described?
Also, do the terms of the Android Market permit such a thing?
I’ve successfully used DexClassLoader. It’s important to provide a
dexOutputDirthat is actually writeable by your app, so not/data/dalvik-cache. Otherwise the log will show one or two lines about failing to write there, followed byClassNotFoundException.To make
Class.forName()work, you could try Thread.setContextClassLoader() (I haven’t).