开发者

how to use dx to generate dex file for java program referencing external package libraries

I'm a newbie Android developer and wish to know how to use dx to generate the dex file/s for a java program that references external package libraries. Ultimately, I'm trying to run this generated dex file/s using dalvikvm at command line within an Android device.

Here is an example of my problem:开发者_如何转开发

If I have a java HelloWorld.class which references a package moon.jar (e.g. I instantiate an object from the package within the main method in HelloWorld.class), what should be the full and exact dx command to issue to generate the dex file/s?

With the dex file/s generated, how should I package them into a jar?

With the generated jar, what should be the full and exact dalvikvm command to run the jar file in command line in the Android device?

Hope to hear from the dx and dalvikvm experts out there, thanks!!


dx should be used twice, once for converting HelloWorld.class, and another time for converting moon.jar. The respective dex files should be individually compressed into jar files. Lastly, the dalvikvm command will then be:

dalvikvm -cp .jar:.jar HelloWorld

Note: To use dalvikvm to run programs, the user must be root (which can be accomplished using apps like SuperOneClick).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜