This bash script will install NDK to AndroidIDE and Termux.
How to install Ndk to AndroidIDE and Termux.
-
Download the NDK installation script:
cd && pkg upgrade && pkg install wget && wget https://github.com/MrIkso/AndroidIDE-NDK/raw/main/ndk-install.sh --no-verbose --show-progress -N && chmod +x ndk-install.sh && bash ndk-install.sh
-
Choose your required NDK version from the list by entering the numbers provided and wait for the installation to complete.
-
After installation, edit or set
ndkVersionin yourbuild.gradleorbuild.gradle.ktsfile as follows:- If you choose
r24, setndkVersionto"24.0.8215888". - If you choose
r28c, setndkVersionto"28.2.13676358". - If you choose
r29, setndkVersionto"29.0.14206865".
- If you choose
You can find the downloaded ndk version names by running:
ls $HOME/android-sdk/ndk(
Example:
plugins {
id 'com.android.application'
}
android {
compileSdk 33
buildToolsVersion "33.0.0"
ndkVersion "28.2.13676358"
defaultConfig {
applicationId "com.myapplication"
minSdk 23
targetSdk 33
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
externalNativeBuild {
cmake {
path file('src/main/cpp/CMakeLists.txt')
}
}
}
dependencies {
...
}
Thanks to: