Android Studio的几个Error与解决方案:“NDK not configured”;“Received close_notify during handshake”

NDK not configured. Download it with SDK manager.

问题

新安装的Android Studio报出以下错误:

其实,已经安装了NDK。但我还是点击Update试了试。然后就遇到了另一个问题:==Could not find method ndkVersion() for arguments on object of type com.android.build.==如下图:

解决问题

通过点击提示Open File发现文件的android标签的最下面有这么一行:

ndkVersion '21.2.6472646'

这行就是问题所在了,但去掉后还会出现最开始的NSK not configured的错误,套娃出现。这是因为项目中没有配置NDK的路径,编译时找不到了,所以打开local.properties文件,发现果然没有ndk的配置,加上本机的NDK路径:

ndk.dir=D\:\\AndroidSDK\\ndk\\16.1.4479499
sdk.dir=D\:\\AndroidSDK

再次编译,SUCCESSFUL!

Received close_notify during handshake.

问题

Android Studio报出以下错误:Received close_notify during handshake.
问题存在原因:这是Android编译错误,jcenter里面的东西下载不了引起的。

解决问题

在项目的build.gradle文件中将jcenter()换成阿里的源,具体示例代码如下。

//jcenter()
maven{ url'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url'http://maven.aliyun.com/nexus/content/repositories/jcenter'}

修改之后再重新Sync Project即可。
整体代码如下。

buildscript {
    
    repositories {
        google()
        //jcenter()
        maven{ url'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven{ url'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        //jcenter()
        maven{ url'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven{ url'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

参考

  1. https://blog.csdn.net/u012558210/article/details/106427634/
  2. https://blog.csdn.net/lxy1740/article/details/104606385/
  3. https://blog.csdn.net/qq_33618456/article/details/75808153
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

天富儿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值