I have a project with native C++ code and a JNI wrapper. Works just fine. I have one project/repository that builds and publishes the library for Android using the com.android.library plugin, producing an AAR artifact. I also have another project/repository that does the same thing for server side using the java-library and cpp-library plugins, but producing a Jar file with the native library bundled and then it gets loaded from the Jar. The C++ code is included as a git submodule so that isn’t duplicated but all the other code like the JNI wrapper is. Basically other than the project layout and the build.gradle differences for the plugins there’s no difference. I’d like to combine into one project/repository that can produce and publish either the Android or the server side artifacts depending on what I choose. I’ve tried looking into variations of different flavors or external builds but have not been able to make it work correctly in a combined repository. The main difficulty seems to be the need for the android plugin in order to see the NDK to do cross compilation of the native library since the cpp-plugin does not seem to support the NDK yet. Is there a way to accomplish this without a lot of heavy external build scripts, installations etc? Thanks!