There is a tools called "dx", this tool can transfer Java Binary Code into Android Dalvik Binary code.
In Android, Java Binary Code cannot be recognized.
1. 首先解决 "How to load a Java class dynamically on android/dalvik?"
可以使用DexClassLoader类来动态加载外部class。
DexClassLoader: "A class loader that loads classes from .jar
and .apk
files containing a classes.dex
entry.
This can be used to execute code not installed as part of an application." [Ref2] [Tdo1]
2. 接下来解决 "How to use a Java class which is loaded dynamically in Android/dalvik?"
A:采用Java语言本身的Reflection功能。
B:采用预定于的接口,插件中的EntryClass来实现该接口。
3. 最后解决 "How to use the asset, like image, audio file?"
Reference
1. Android App 插件架构的设计
https://enplug.com/blog/loading-classes-dynamically-on-android-particularly-when-you-have-to-use-them-in-a-third-party-framework-like-libgdx
http://stackoverflow.com/questions/3022454/how-to-load-a-java-class-dynamically-on-android-dalvik
2. DexClassLoader
http://developer.android.com/reference/dalvik/system/DexClassLoader.html
3. Custom Class Loading in Dalvik
http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html
Ant的使用
Todo
1. 研究dalvik包,来看看dalvik包可以为我们带来什么支持?
dalvik.system
dalvik.bytecode
dalvik.annotation
2. Dive into Android Source
http://android.github.io/
3. Dive Into Ant
Ant的使用,学习