不支持Android 11(R)的NDK版本

问题描述 投票:1回答:1

反正有为Android R图像构建C / C ++项目吗?

im得到:“ C / C ++版本| x86_64:NDK'D:\ Android_sdk \ ndk \ 21.1.6352462”不支持API codeName'R'。错误。

这是项目结构:

enter image description here

此构建使用的是Android Studio 4 RC1Android R预览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'

}
android android-studio android-ndk
1个回答
0
投票

根据this comment,您需要从canary频道安装更新的NDK:

Android Studio菜单,“设置>外观和行为>系统设置>更新”选择“金丝雀频道”金丝雀的NDK将启用下载:“工具> Sdk管理器> SDK工具”(假设启用了“显示软件包详细信息”)“ NDK并排”

或者您可以从命令行通过以下方式安装它:>

sdkmanager --channel=3 --install 'ndk;21.1.6363665'
© www.soinside.com 2019 - 2024. All rights reserved.