解决“Error:No toolchains found in the NDK toolchains folder for ABI with prefix: mipsel-linux-android”
问题:
最近SDK Tools中安装了NDK,于是在最近的项目中的就出现了如图所示的错误:mipsel-linux-android的缺失
问题描述
好久之前的一个Android项目,最近需要重构一下
因为Android Studio的开发环境以及Gradle的版本等等都进行了一定的更新,于是导入Project以后,出现了报错:
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
如图所示:
显然这个错误是由于Android3.0(当然也可能是更高的版本)开发环境的版本更新所导致的
相关背景
NDK,是Native Development Kit的缩写,这是 Android的一个工具开发包,与java语言没有直接的关系
Native就是指C、C++这些语言
使用NDK可以快速开发C、C++的动态库,并自动将这些so文件与其他内容一起打包成APK
Android Studio环境下关于NDK的配置
先把目录切换为Project模式,点这个地方就行
然后选择local.properties文件,就是我标红的这个
可以看到这里记录了NDK和SDK在本地计算机上的存储路径
进一步分析
首先打开SDK manager
出现以下界面
这里可以看到我的NDK是已经下载好的
那么这个下载好的NDK的路径在哪里呢,或者说这个下载好的NDK究竟放在哪里呢,我们查找一下
如下图操作,打开project structure
弹出如下界面
这里就是我们NDK的路径(位置了)
把这个路径复制一下,然后在我的电脑中打开,如图所示
打开这个目录下的toolchains文件夹
可以看到,这里确实没有IDE里报错说我们需要的那种库
解决方法:
1 解决方法是到Androidstudio(Tools->Android->SDKManager).选中ndk项,并将其删除。
2 如果程序需要的话。
(1)找到NDK的根目录:
File/Project Structure/SDK Location/Android NDK location
(2)复制NDK地址到本地电脑中进行查找,E:\Android\Sdk\ndk-bundle,找到toolchains文件夹并打开。
(3)进入Android Studio中文社区,在TOOLS导航栏下找到NDK,找到相应的版本进行下载。点击下载:通过浏览器单独下载NDK的包
(4)将文件进行下载,解压。
(5)解压缩后,打开toolchains文件夹,找到错误提示中缺失的文件名。
(6)将此文件夹进行复制粘贴到ndk所在目录的toolschain文件中。
(7)回到Android Studio中,点击AS中的更新按钮进行更新,问题就哈皮滴解决啦~