Android Studio 3.2.1解决错误信息"No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android"

在用Android Studio 3.2.1导入以前的项目,进行编译的时候,报告如下错误信息:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

CONFIGURE FAILED in 5s
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android

这个错误信息的原因是从NDK r17版本开始,已经不支持"armeabi、mips、mips64"这三种ABI格式了,而当前机器上安装的NDK版本是NDK r17之后的版本。

不过这个提示很能迷惑人,会让人误以为自己的build.gradle中配置了MIPSABI。实际上根本没有配置,是低版本的构建工具自己在默认构建MIPS格式,而又找不到对应的工具链。

解决方法很简单,要么使用低于NDK r17NDK版本,要么修改主工程的build.gradle,找到如下

// Top-level build file where you can add configuration options common to all sub-projects/modules.
configure(allprojects) {
    buildscript {
        repositories {
		    google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.0'
        }
    }

    repositories {
          jcenter()
    }
}

将其中的

classpath 'com.android.tools.build:gradle:3.0.0'

修改成

classpath 'com.android.tools.build:gradle:3.2.1'

高版本的构建工具,才能适配高版本的NDK

参考链接


发布者

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注