Android APK Proposal
pawandubey Mar 6, 2014 2:30 PMHi, I am Pawan, a GSoC aspirant in the short term and an aspiring contributor in the long term
Initially I was interested in the task to export to RAR, ISO and BZIP etc formats through ShrinkWrap, as listed on the ideas page. However, with my ongoing communications with alrubinger and kpiwko , this has now evolved into primarily adding an Android APK export functionality in ShrinkWrap.
As of what intel I have managed to gather from scavenging online resources, is this:
1. APK is a zip-like archiving format, especially developed for Android based operating systems.
2. And APK package contains of a fixed directory structure containing the following:
- Manifest file(for meta info about the archive itself)
- res folder(for all non-logic resources(e.g strings, images etc))
- src (for the java source files)
- assets
- obj (to store compiled java source files as .class files)
- bin (to store .dex files created)
3. The workflow of creating an APK package goes something like this:
- The proper directory structure as described above is created
- Java source files are added to the src folder and the resources to the resources and assets folder.
- Manifest file is created with proper references to all the resources etc.
- The java resource files are compiled to R.java file by aapt tool provided in the android SDK.
- The java source files are compiled into a .class file and stored in the obj directory using the javac tool.
- The .dex files are the Android executables. We need to convert the .class files created in the previous step and the third party dependencies by compiling them to classes.dex file by the dx tool. This is stored in the bin directory.
- The aapt(or apkbuilder?) tool is used to package the contents of the directory into an .apk file(unsigned).
- The unsigned package then needs to be signed using some suitable tool. Like jarsigner?
- Then the signed package needs to be zipaligned as a final step.
As far as the project is concerned, we will need to build an api for each step of the workflow as I didnt find any reusable code as yet. Any further guidance as to how to proceed further would be mightily appreciated. Especially, as kpiwko mentioned, can smikloso provide some insight here please?