Android studio升级到4.1.2后以前的项目会出现一些问题,如下:
1、报错
A problem occurred configuring project ':app'.
> Could not download support-annotations.jar (com.android.support:support-annotations:26.0.1)
> Could not get resource 'https://maven.google.com/com/android/support/support-annotations/26.0.1/support-annotations-26.0.1.jar'.
> Could not HEAD 'https://maven.google.com/com/android/support/support-annotations/26.0.1/support-annotations-26.0.1.jar'.
> Connect to maven.google.com:443 [maven.google.com/172.217.24.14] failed: Connection timed out: connect
解决方案
allprojects { repositories { maven {url 'https://dl.google.com/dl/android/maven2/'} maven {url 'https://www.jitpack.io'} jcenter() } }
2.Android studio升级到4.1.2后logcat和build出现中文乱码
解决方案
找到Android studio的安装路径下的bin文件
打开这两个文件添加一行-Dfile.encoding=UTF-8,保存后关闭文件即可
重启Android studio后中文乱码即可解决
也有网友说点击Help—>Edit Custom VM Options,打开文件添加-Dfile.encoding=UTF-8,但是我的这个必须创建,再添加进去吴作用,我想可能是安装路径的不用吧
3.gradle插件加载失败,但是我的插件是本地,真是太奇怪
Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.
A problem occurred configuring root project 'trunk'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.5.2.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.5.2.
> Could not get resource 'https://maven.google.com/com/android/tools/build/gradle/3.5.2/gradle-3.5.2.pom'.
> Could not GET 'https://maven.google.com/com/android/tools/build/gradle/3.5.2/gradle-3.5.2.pom'.
> Connect to maven.google.com:443 [maven.google.com/216.58.200.238] failed: Connection timed out: connect
解决方案
原来gradle的配置如下图:
把
maven{url'https://maven.google.com'}换成
maven {url 'https://dl.google.com/dl/android/maven2/'}
如下图