Issue
Is there anyway to build C/C++ project for android R image ?
im getting : "C/C++ release|x86_64 : API codeName 'R' is not supported by NDK 'D:\Android_sdk\ndk\21.1.6352462" error.
this is project stracture :
Im using Android Studio 4 RC1 , Android R Preview and NDK Version 21.1 for this build.
this is the gradle config :
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion "android-R"
buildToolsVersion "30.0.0 rc4"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion "R"
targetSdkVersion "R"
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-std=c++17"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version "3.10.2"
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Solution
As per this comment, you need to install a newer NDK from the canary channel:
Android Studio menu,"settings > Appearance & Behavior > system Settings > Updates"
choose "Canary Channel"
The canary NDKs will be enabled for download:
"Tools > Sdk Manager > SDK Tools"
( assuming "Show Package Details" is enabled ) "NDK side by side"
Or you can install it from the command line with
sdkmanager --channel=3 --install 'ndk;21.1.6363665'
Answered By - Botje
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.