How the Android program is changed from the source code to the APK that can be installed using
Original link http://sparkyuan.github.io/2016/04/01/from source to apk/, reprint please indicate source
Process official version
Detailed version
Above is a typical flowchart of the build process.
- AAPT (Android Asset Packaging Tool) provides your activity with the required resource files, such as androidmanifest.xml,xml files, and compiles them. The R.java file is also generated so that you can reference these resources in Java code.
- The Aidl tool converts the. Aidl interface into a Java interface.
- All of your Java code, including R.java and. aidl files, is output. class files by the Java compiler and compiled.
- The Dex tool converts. class files to Dalvik byte files, and third-party classes and. Class are also converted to. dex files
- All resources that cannot be compiled (slices), compiled resource files, and. Dex are sent to the Apkbuilder tool to generate the final. apk
- The. apk must be built with debug or release,release to provide the corresponding key
- If you choose Release version, you also need to use the Zipalign tool to align the apk. The alignment means that all resource files are offset from the file starting at 4 bytes in integer multiples, which makes it faster to access the APK file through memory maps.
Output
Generated apk in the app/build/outputs/apk/directory, the naming rules app--. apk, for example, app-demo-debug.apk.
Original link http://sparkyuan.github.io/2016/04/01/from source to apk/, reprint please indicate source
From Android source to apk--apk packaging process