android - 未找到兼容的并排 NDK 版本。默认为 20.0.5594570
问题描述
我收到上述错误
我的 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'
}
无法理解为什么会这样。
谢谢
解决方案
修复: 将ndkVersion添加到模块的 build.gradle
android.ndkVersion "your-installed-ndk-version"
就像在一些例子中一样。您可以从文件 $NDK/source.properties 中找到您的 NDK 版本。
背景信息:
您可能使用 AGP/Android Studio 3.6+ 版:“从 Android Gradle Plugin (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。
附加文档: 详见官方文档。
推荐阅读
- python - 在 Python 中反转组/项目
- html - 需要在 Wordpress Bakery 中使用 CSS 更改图像大小
- css - CSS 变换动画会导致后续模糊元素出现视觉故障(仅限 Chrome)
- python - Django模型字段默认=无用?
- ios - 如何使用 GRDB 在 iOS 上查询具有 1-1 关联的表?
- powershell - 使用 powershell Get-Content 和 Set-Content 编辑文本文件时遇到问题
- ios - 来自 frame.height 的 CGFloat 值
- assembly - 进入 32 位保护模式无法按预期工作
- javascript - 如何将代码作为对象键值对传递
- go - 如何在 Go 中将选项卡添加到 Fyne GUI?