我想编译一个开源的
Android项目(Netguard)使用gradel(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项目:
- 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.+'
- }
而且我正在使用毕业生2.9全部和android-ndk-r10e.我不知道我是否应该提及其他任何内容,如果您需要任何信息,请给予评论.
解决方法
错误消息:“没有工具链在NDK工具链文件夹中找到ABI,前缀为:llvm”.
在使用NDK的Android Studio进行新鲜的网络安装后,我导入了一个使用GitHub使用NDK的Android代码示例,并尝试编译它.
结果发生错误:
No toolchains found in the NDK toolchains folder for ABI with prefix: llvm
解:
由于某些原因,MAC上的标准安装过程无法安装完整的集:
〜/ Library / Android / sdk / ndk-bundle丢失了所有工具的文件夹工具链,
(应该是这样的:〜/ Library / Android / sdk / ndk-bundle / toolchains)
解决方法是单独下载NDK,打开它,复制文件夹工具链并将其粘贴到文件夹中:
- ~/Library/Android/sdk/ndk-bundle
之后,它对我来说很好.