错误:在 ABI 的 NDK 工具链文件夹中找不到工具链,前缀为:llvm [英] Error: No toolchains found in the NDK toolchains folder for ABI with prefix: llvm

查看:35
本文介绍了错误:在 ABI 的 NDK 工具链文件夹中找不到工具链,前缀为:llvm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用gradel(gradlew clean build)编译一个开源的android项目(Netguard)但是我遇到了这个错误:

I want to compile an open source android project (Netguard) using gradel (gradlew clean build) But I encountered this Error:

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:

I serached but didn't find enything helping. Here is the main 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
}

这是app项目的build.gradle:

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-allandroid-ndk-r10e.我不知道我是否应该提及其他任何信息,如果您需要任何信息,请发表评论.

And I'm using gradle-2.9-all and android-ndk-r10e. I don't know if I should mention anything else, so comment if you need any information.

推荐答案

两年过去了,现在如果你遇到这里,你可能会遇到这样的错误信息:

Two years has passed, now if you come across here, you may possibly encounterd error message like this:

在带有前缀 mips64el-linux-android 的 ABI 的 NDK 工具链文件夹中找不到工具链

No toolchains found in the NDK toolchains folder for ABI with prefix mips64el-linux-android

在带有前缀 mipsel-linux-android 的 ABI 的 NDK 工具链文件夹中找不到工具链

No toolchains found in the NDK toolchains folder for ABI with prefix mipsel-linux-android

最新的 NDK 删除了对 mips abi 的支持,早期版本的 android gradle 插件仍然检查 mips 工具链的存在.查看此处了解详情.

Latest NDK removed support for mips abi, and earler version of android gradle plugin still check for the existance of mips toolchain. see here for more info.

解决方案:将 android gradle 插件升级到 3.1 或更高版本.

Solution: Upgrade android gradle plugin to 3.1 or newer.

例如在项目级别 gradle [28-Sept-2018]

e.g. Add following in the project level gradle [28-Sept-2018]

 classpath "com.android.tools.build:gradle:3.2.0"

解决方法:创建 mipsel-linux-android 文件夹结构来欺骗工具.最简单的方法是符号链接到 aarch64-linux-android-4.9.

Workaround: Create mipsel-linux-android folder structure to fool the tool. The easiest way would be to symbolic link to 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

<小时>

查看解决此类问题的三个选项的这个线程

这篇关于错误:在 ABI 的 NDK 工具链文件夹中找不到工具链,前缀为:llvm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆