目录
- 一、Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.
- 二、Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.
- 三、This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime unless you add the constraints
一、Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.
直接降版本,使用api30
然后修改build.gradle中的三处代码
注意buildToolsVersion要30.0.2
之前使用30.0.0报错如下:
The specified Android SDK Build Tools version (30.0.0) is ignored, as it is below the minimum supported version (30.0.2) for Android Gradle Plugin 4.2.0.
Android SDK Build Tools 30.0.2 will be used.
To suppress this warning, remove “buildToolsVersion ‘30.0.0’” from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
大致意思就是当前gradle支持的最低版本是30.0.2;
再去项目结构中修改SDKs,把api30加进去
修改完点击这里立即同步,就会重新build
二、Please remove usages of jcenter()
Maven repository from your build scripts and migrate your build to other Maven repositories.
This repository is deprecated and it will be shut down in the future.
See http://developer.android.com/r/tools/jcenter-end-of-service for more information.
Currently detected usages in: root project ‘My Application’, project ‘:app’
这个意思就是jcenter不能用了。。
看这个warning就知道了
所以给gradle配置阿里云镜像即可
在build.gradle中,buildScript和allProjects中的repositories,改为以下代码
mavenLocal() //使用本地maven仓库
//阿里云Maven镜像
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'https://maven.aliyun.com/repository/google'}
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
mavenCentral() //使用maven中心仓库
可以参考阿里云maven仓库指南https://developer.aliyun.com/mvn/guide
以下是我完整的build.gradle内容
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
/*google()
mavenCentral()*/
mavenLocal() //使用本地maven仓库
//阿里云Maven镜像
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'https://maven.aliyun.com/repository/google'}
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
mavenCentral() //使用maven中心仓库
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
/*google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon*/
mavenLocal() //使用本地maven仓库
//阿里云Maven镜像
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'https://maven.aliyun.com/repository/google'}
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
mavenCentral() //使用maven中心仓库
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
三、This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime unless you add the constraints
意思就是没有添加约束,因为我们使用的是constraintlayout,没有约束的话一些控件会跳转到(0,0)的位置
点击这个魔法棒就可以了