Question

I've spent the last few days struggling with getting a system up and running for building multiple configurations of our Android NDK App. I am able to build the libraries fine; the issues I run into usually stem from keeping those libraries up to date when changing build configurations.

I need a system that is for the most part fully automated: the user should just change build configurations and everything just works!

How have you addressed build configurations and the issues with libraries not being properly rebuilt?

I've tried a bunch of different approaches to this, but they all seem to end up with issues that are out of my hands.

Initially we just outputted a Shared Object file with the same name regardless of Build Configuration (eg. game.so). The problem is, changing build configurations doesn't trigger the library to be rebuilt; you have to make a change to the source or build scripts. So people change from Debug to Release, run the app, and are unknowingly actually linking to the Debug version still.

So then we tried outputting the library to a unique Shared Object based on the build configuration. For example, the debug version is gamed.so. The release version is gamer.so. The problem is, the Java code has no concept of build configuration, so how do we know which version of the library to load (which is done from Java)?

Well to get around that we do a try/catch looping through all the possible versions of the library attempting to load them. When we find the one that exists, load it! Problem being that the old versions of the library do not get removed when deploying a new configuration to the phone. So if you have built and run both Debug and Release, both of those libraries are now on the phone! Which ever one you ask for first, it will find and load.

So anyway, this seems like something that must have been solved already, but I have found very little information online. Nothing that has met my needs.

My question is: how have you addressed build configurations and the issues with libraries not being properly rebuilt?

Was it helpful?

Solution

This is actually strange. I have always seen that install -r refreshes the /data/data/app.pack.age/lib directory. Which device do you use for development?

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