最全解决办法: No version of NDK matched the requested version 20.0.5594570

最全解决办法: No version of NDK matched the requested version 20.0.5594570NDK环境变量配置androidstudio更新到3.6,构建NDK项目的时候NDK版本引起的同步报错NoversionofNDKmatchedtherequestedversion20.0.5594570.Versionsavailablelocally:21.1.635方法1(AndroidStudio环境)您只需在“项目结构”对话框中选择本地安装的NDKYoucanopentheProjectStructureDialogbyclickingFi

大家好,欢迎来到IT知识分享网。

NDK环境变量配置

android studio更新到3.6,构建NDK项目的时候NDK版本引起的同步报错

No version of NDK matched the requested version 20.0.5594570. Versions available locally: 21.1.635

方法1(Android Studio环境)

您只需在“项目结构”对话框中选择本地安装的NDK
You can open the Project Structure Dialog by clicking File > Project Structure… or by pressing the hotkeys CTRL + ALT + SHIFT + S (on windows)
Once the Project Structure Dialog is open, go to SDK Location and select your locally installed version of NDK under Android NDK Location. Typically this is installed somewhere in your user folder then \AppData\Local\Android\Sdk\ndk%ndk version% at least for Windows.
Project Structure dialog screenshot – from Android Studio 3.6 Build #AI-192.7142.36.36.6200805, built on February 12, 2020
在这里插入图片描述在这里插入图片描述
Android NDK location
This location will be saved as ndk.dir property in the local.properties file.

D:\Android\Sdk\ndk\20.0.5594570

方法2 (官方推荐方法)

Doing option 1 will edit your local.properties file for you and will work in most cases. But if you want to use a consistent NDK version on all machines you build the project with, according to this official guide, you can configure it from your module gradle script. Simply add the ndkVersion in your module gradle script’s android{} block like so.
android {

ndkVersion “major.minor.build”
}

用您要使用的NDK版本替换双引号之间的字符串,例如:

android { 
   
    ndkVersion "21.1.6352462"
}

方法3 (官方不推荐的方法)

本人采用该方法!!!
WARNING: Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.
Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead.

Linux环境:

sudo vim /etc/profile

最末尾添加如下环境变量:

export ANDROID_HOME=/home/user/android-sdk
export PATH=$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$PATH
export PATH=$ANDROID_HOME/build-tools/29.0.3:$PATH

**export ANDROID_NDK_HOME=/home/user/android-sdk/ndk/21.1.6352462/
export PATH=$PATH:$ANDROID_NDK_HOME**

参考
Android没有NDK版本与要求的版本相符
https://mlog.club/article/5271812

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/16170.html

(0)

相关推荐

发表回复

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

关注微信