未找到兼容的并排 NDK 版本。默认值为 20.0.5594570

Vik*_*han 18 android android-ndk

我收到上述错误

我的gradle看起来像这样

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.example.hypersignwalletcorekotlin"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}
project.ext {
    walletcore_version = "2.0.5"
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation "com.trustwallet:wallet-core:$walletcore_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Run Code Online (Sandbox Code Playgroud)

无法理解为什么会发生这种情况。

谢谢

Ger*_*rry 18

修复:ndkVersion添加到模块的 build.gradle

    android.ndkVersion  "your-installed-ndk-version"
Run Code Online (Sandbox Code Playgroud)

一些例子中。您可以从文件 $NDK/source.properties 中找到您的 NDK 版本。

背景信息: 您可能使用 AGP/Android Studio 3.6+ 版:“从 Android Gradle 插件 (AGP) 3.6+ 开始,known good NDK添加了一个概念,known good/tested NDK version即 AGP 版本发布的时间”。如果出现以下情况,AGP 将使用该内部 NDK 版本:

  • 您没有使用AGP 3.5 中添加的ndkVersion功能

内部 NDK 预计将安装为并排 NDK 位置: $SDK\ndk
如果未安装:

  • AGP 3.6、AGP 4.0 会报错
  • AGP 4.1 会自动安装它。

内部嵌入的 NDK 版本很可能会很快过时,因为新的 NDK 不断发布:如果您想使用更新的 NDK 版本,则需要使用ndkVersion配置gradle

附加文档: 详见官方文档


小智 6

要安装特定版本的 NDK,请执行以下操作:

打开项目后,单击工具 > SDK 管理器。

单击 SDK 工具选项卡。

选中显示包详细信息复选框。

Select the NDK (Side by side) checkbox and the checkboxes below it that correspond to the NDK versions you want to install. Android Studio installs all versions of the NDK in the android-sdk/ndk/ directory.


Otz*_*iii 5

我不使用NDK,但仍然出现此错误。清洁项目对我有用。

构建->“清理项目”,然后重建。