我想使用gradel编译一个开源android项目(Netguard)(gradlew clean build
)但是我遇到了这个错误:
A problem occurred configuring project ':app'.
> Exception thrown while executing model rule: NdkComponentModelPlugin.Rules#cre
ateToolchains
> No toolchains found in the NDK toolchains folder for ABI with prefix: llvm
我搜索过但没有找到任何帮助。这是主要的build.gradle
:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.6.0-alpha1'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是build.gradle
of the app
项目:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
defaultConfig.with {
applicationId = "eu.faircode.netguard"
minSdkVersion.apiLevel = 21
targetSdkVersion.apiLevel = 23
versionCode = 2016011801
versionName = "0.76"
archivesBaseName = "NetGuard-v$versionName-$versionCode"
}
}
android.ndk {
moduleName = "netguard"
toolchain = "clang"
ldLibs.add("log")
}
android.sources {
main {
jni {
source {
srcDir "src/main/jni/netguard"
}
exportedHeaders {
}
}
}
}
android.buildTypes {
release {
minifyEnabled = true
proguardFiles.add(file('proguard-rules.pro'))
ndk.with {
debuggable = true
}
}
}
android.buildTypes {
debug {
ndk.with {
debuggable = true
}
}
}
android.productFlavors {
create("all") {
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.+'
compile 'com.android.support:recyclerview-v7:23.1.+'
compile 'com.squareup.picasso:picasso:2.5.+'
}
我正在使用gradle-2.9-all
and android-ndk-r10e
。我不知道是否应该提及其他内容,因此如果您需要任何信息,请发表评论。
两年过去了,现在如果你遇到这里,你可能会遇到这样的错误信息:
在 NDK 工具链文件夹中找不到前缀为 mips64el-linux-android 的 ABI 工具链
or
在 NDK 工具链文件夹中找不到前缀为 mipsel-linux-android 的 ABI 工具链
最新的 NDK 删除了对mips
abi 和早期版本的 android gradle 插件仍然检查 mips 工具链是否存在。请参阅此处了解更多信息.
Solution:将android gradle插件升级到3.1或更高版本。
例如在项目级别 gradle 中添加以下内容 [2018 年 9 月 28 日]
classpath "com.android.tools.build:gradle:3.2.0"
解决方法: 创造mipsel-linux-android
文件夹结构来欺骗该工具。最简单的方法是符号链接到aarch64-linux-android-4.9
.
# on Mac
cd ~/Library/Android/sdk/ndk-bundle/toolchains
ln -s aarch64-linux-android-4.9 mips64el-linux-android
ln -s arm-linux-androideabi-4.9 mipsel-linux-android
检查这个线程三个选项为了解决此类问题
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)