Post-build copy for Android

Hi, there’s no post-build step in Projucer for Android, and the binary location field doesn’t appear to be used for static libraries, i.e. filling this is doesn’t copy my library to this location at the end of the build.

Should the library be copied and should there be a post-build step? thx

Hey leehu I am running into the same issue, did you ever solve your problem?

Hi, no - had to work round it by pathing in the directories where the libraries are.

Maybe we can get this some attention though - not sure why they can’t fix this.

Cheers

I have contacted Fabian, with the following solution to be integrated in cmakelists

https://forum.juce.com/t/static-library-artifacts-for-android/28067

It’s difficult to fix as there is not one binary directory on Android. gradle will create a bunch of static libraries for every architecture. Also a post-build script doesn’t really work as we don’t know if the post-build script will be executed on Windows (.bat script) or on macOS/Linux.

As @leehu points out, the better solution to this problem is to have the app which uses your static library to search in the right location. For example, ROLI’s NOISE app adds the following library search path to the Android exporter:

The nice thing is that gradle will expand the ${ANDROID_ABI} variable for you.

1 Like

thanks for the prompt answer Fabian, the solution would work for small projects, this however would make my workflow too convoluted. My android project is used by many projects in pipeline, and having to specifically point to this specific folder for all projects is a maintenance-nightmare. If I understand correctly you are using cmake anyway and gradle is only running it. The libraries are a fat binary anyway, so my recommendation should work by adding the SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY “…/…/…/…/…/…/…/…/lib/Android/Debug”) line in cmakelists. or I might be missing some crucial aspects here?

What happens if you do this? Does gradle then create multiple sub-directories for each architecture?

I don’t quite understand how this would be any different to your approach. You would also need to specifically point to the CMAKE_ARCHIVE_OUTPUT_DIRECTORY in all the projects which use your static lib.

we have a global lib folder search path, that is being set once for every project that need the libraries, and we dont worry about what might be in the lib path.

well gradle does nothing, but cmake copies the stuff under Android/Debug for debug builds and Android/Release for release, or whatever other structure there might be

I honestly think this line should be added for projucer android exporters, since in all other exporters, the binary location is actually being used and for android it is completely ignored.

ah and to be clear about this, I am talking about binary location field not the post-build scripts

OK - this is now fixed with commit 224bed4.

1 Like