Android 11(R) 的 NDK 构建不受支持
NDK build for Android 11(R) not supported
有没有为 android R 图像构建 C/C++ 项目?
我收到:"C/C++ release|x86_64 : API codeName 'R' is not supported by NDK 'D:\Android_sdk\ndk.1.6352462" 错误。
这是项目结构:
我正在使用 Android Studio 4 RC1、Android R Preview 和 NDK此版本的版本 21.1。
这是 gradle 配置:
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'
}
根据this comment,您需要从 Canary 频道安装更新的 NDK:
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"
或者您可以使用
从命令行安装它
sdkmanager --channel=3 --install 'ndk;21.1.6363665'
有没有为 android R 图像构建 C/C++ 项目?
我收到:"C/C++ release|x86_64 : API codeName 'R' is not supported by NDK 'D:\Android_sdk\ndk.1.6352462" 错误。
这是项目结构:
我正在使用 Android Studio 4 RC1、Android R Preview 和 NDK此版本的版本 21.1。
这是 gradle 配置:
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'
}
根据this comment,您需要从 Canary 频道安装更新的 NDK:
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"
或者您可以使用
从命令行安装它sdkmanager --channel=3 --install 'ndk;21.1.6363665'