Android Studio的几个Error与解决方案

  • NDK not configured. Download it with SDK manager.
    • 问题
    • 解决问题
  • 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.4479499sdk.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

更多相关文章

  1. 一款常用的 Squid 日志分析工具
  2. GitHub 标星 8K+!一款开源替代 ls 的工具你值得拥有!
  3. RHEL 6 下 DHCP+TFTP+FTP+PXE+Kickstart 实现无人值守安装
  4. Linux 环境下实战 Rsync 备份工具及配置 rsync+inotify 实时同步
  5. android AlertDialog或toast显示错误 Unable to add window toke
  6. Android(安卓)出现 avc: denied { execmod }如何处理?
  7. armeabi和armeabi-v7a
  8. 使用SVN管理Android工程
  9. 使用HTTPclient访问豆瓣API问题

随机推荐

  1. Android TV开发中所有的遥控器按键监听及
  2. Android系统服务Fuzz测试
  3. Android平台开发-Power management-电源
  4. 清单文件,测试,打电话和发短信应用
  5. Android 中文 API (101) —— AsyncTask
  6. 布局管理器
  7. android 判断sdcard是否存在,以及写入权限
  8. Android(安卓)2.0中电话本contact的读写
  9. Android倒计时功能的实现
  10. android程序编写的小问题