porting javac and dx to android

只谈情不闲聊 提交于 2019-12-11 17:32:21

问题


Hi i'm planning on porting the javac compiler and dx converter to android..Is this going to be a trivial Task or are there any major Roadblocks?

My idea is to create an app so that people can compile java source code in the android devices and maybe even make android apps in the same android devices...

is this possible?


回答1:


Most people would not consider it trivial.

You list javac and dx as things that need to be ported. Those are certainly requirements. You would need to create an ARM port of javac (and all the system libraries that it might use that are not on Android). You would also need to attempt to create a version of dx that would run on Dalvik VM, as it is written for the Java VM.

Beyond that, you would need to port, at minimum:

  • aapt and all the system libraries that it might use that are not on Android
  • aidl and all the system libraries that it might use that are not on Android
  • the LLVM compiler
  • Ant (written in Java, but for the Java VM and very likely will not run on the Dalvik VM without modifications)
  • the entire imported set of Ant tasks used by the build process (also written for the Java VM)
  • other Java SDK tools used by those Ant tasks as part of the build process (e.g., jarsigner, keytool)

And then you would need to create an Android app that could invoke the Ant task to do the build, bearing in mind that the Android shell is rather limited and could conceivably place its own impediments on this process. Such an app would need to capture stdout and stderr and report the results to the user (e.g., compile errors). You would likely also need to roll your own miniature IDE, unless there is an existing text editor sufficient for your needs.

I would estimate this as taking well in excess of 100 engineer-months. So, if your firm has tasked a nice-sized team for the project, you might have it done in a year or so.



来源:https://stackoverflow.com/questions/8688736/porting-javac-and-dx-to-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!