Regarding creation of APK through CMake (CMakeAPK idea)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Regarding creation of APK through CMake (CMakeAPK idea)

David Demelier-2

I'm currently experimenting Android development with CMake without using
gradle, Android Studio, ant or anything else.

The idea is to use Android's sdk-tools only (aapt, dx, zipalign, apksigner).

The process isn't that hard but consists of several steps. The only real
question is how should an hypothetical CPackAPK would build the
application because the user has to write some java code and
AndroidManifest file.

In a nutshell the process of building an apk consist of:

1. aapt package -f -m -J <input> -M AndroidManifest.xml -S <output> -I
2. javac *.java and output to obj
3. dx --dex --output=classes.dex obj
4. aapt package -f -m -F app.unaligned.apk -M AndroidManifest.xml -S
<output> -I android.jar
5. apksigner sign --ks debug.keystore --ks-pass "blabla"
6. zipalign -f 4 app.unaligned.apk app.apk

So basically, the 1, 3, 4, 5, 6 steps are quite “easy” to implement in a
CPackAPK module but I need to dig how the step 2 should be handled by
that module. Also, we need to incorporate all .so required into the
output directory as well (this could be done with a simple variable I

Any opinions are welcome,

Some sources which helped me:



Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: