Here's my problem:
I've got a library stored at Github. That Library contains native code and everything that's needed for handling C++ files. Locally the project/library works fine but I want to include that library as a dependency via JitPack. So that's where the problem starts...
JitPack seems to use the newest version of NDK but that's not the version my code can be built with. For now, there's no time to update my library but can't find any solution to define the NDK version as a dependency to the project.
I know that ndk.dir
can be defined at local.properties
but that file should not be part of the repo. I wonder if there's a way to tell JitPack which NDK-Version it should use to build the dependency.
I'm curious if any of you already had a similar problem and if anyone has an idea how to solve it.
I appreciate any idea. :)
You should always be using the latest NDK for the best behavior (possibly N-1 if there's a bug in the latest stable, but that won't be the average case). It does sound like your APP_PLATFORM is set to a newer platform than the device you're trying to run on. APP_PLATFORM is a minimum supported version.
Go to Tools->SDK Manager (or Files->Settings->Appearance & Behavior->System Settings->Android SDK ). Then select the SDK Tools tab, and check the Show Package Details checkbox. You will see your NDK version.
Using Android Studio 2.2 and higher, you can use the NDK to compile C and C++ code into a native library and package it into your APK using Gradle, the IDE's integrated build system. Your Java code can then call functions in your native library through the Java Native Interface (JNI) framework.
Today, Android Studio plugin supports side-by-side NDK, and the SDK Manager can manage multiple versions of NDK. In gradle.build, you set e.g. android.ndkVersion '19.2.5345600'
. You can probably trigger SDK Manager programmatically to install the expected version.
Note that sharing local.properties
would not help, because it points to NDK installed directory (which depends on the PC configuration), and does not store the NDK version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With