Compiling android apps on an actual phone

前端 未结 2 516
囚心锁ツ
囚心锁ツ 2021-02-02 03:50

Hi I\'d like to know how to compile an app source code on an android platform? I know it\'s possible because I saw some apps that are doing it... Thanx ahead!

2条回答
  •  梦谈多话
    2021-02-02 04:27

    I think what you are asking for is a way to compile android apps on an android device.

    the way an app like this new IDE does.

    If so what you would need to do is to take an open source java compiler such as the ejc (the Java compiler used within Eclipse) and use it to compile your java source. You would then need to port the dalvik compiler to be able to run, in order to generate dex from the class files generated by the java compiler.

    An interview with he developers of AIDE has a little bit more info on how they did it.

    UPDATE:

    Actually I just came across an open source project which provides similar functionality but based on using vim and the existing SDK cli tools ported to run on a an android device. The project is hosted here.

    UPDATE 2:

    I found yet another open source project that also does on device compile/build which I think should provide you with examples of what you are trying to do...

    More specifically, if you look in IDE.java, you can see how the individual tools (ejc, dx, aapt) are called/used.

提交回复
热议问题