Question

I'm currently working on a large Android app using a massive amount of C++ code. It compiles and runs, so far so good.

Unfortunately, every time I modify something in the structure of my native source (add/delete/rename/move a file), which happens pretty often, ndk-build rebuilds the whole source, even the untouched files.

Does anyone know how I can set up the Android NDK to build incrementally somehow?

Thanks in advance

Was it helpful?

Solution

I got fed up with the NDK build system, studied it for a bit, and wrote my own makefiles. This was not hard.

However, it was then pointed out to me that by doing this, I would have to take responsibility for tracking future changes to the platform, for example if it becomes necessary to ship binaries for additional processor types, I'd have to modify my homegrown build solution to do that too.

In other contexts, I've sometimes had projects with two build systems - one for quick experiments, another for deployable builds. The time spent updating both now and then was saved many times in the speed gain for daily work. Provided I had to do a real build at least every week or two, things never got very far out of consistency (and both build scripts were in the revision control system, so there was history to examine). Something like this could be done with a custom makefile for debug builds and still using the NDK build system for deployable packages.

(In one case of doing a lot of experiments at the edge of what the platform permits, I actually had my makefile pushing the updated .so onto the device and gave my application one of the discouraged hard-quit buttons, so I could restart it using an updated native library without even having to rebuild and reinstall the apk)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top