最近都在接触ios的开发,以至于有段时间没打开AS了,然后昨天打开更新了一下,发现居然出现了好多问题,引用的第三方包都不支持了,还让我一个一个的去掉,这是什么情况,WTF。
才发现Android Studio 3.0.0以上已经默认添加google()作为google的远程仓库了。
遇到问题的时候,我还是喜欢先去分析问题的出现,在更新之前是没有问题的,那么就是新版本的AS有问题,AS有问题,我一般都会先检查三个地方。
1、根目录的build.gradle,检查构建工具的版本,是否是正常的
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta6'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
2、gradle/wrapper/gradle-wrapper.properties里面gradle的版本
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
3、sdk版本,一般检查module下面的build.gradle文件,检查里面的sdk是否不存在,如果是,请下载。
compileSdkVersion 25
buildToolsVersion localBuildToolsVersion
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
defaultConfig {
applicationId "com.voctex"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
// dex突破65535的限制
multiDexEnabled true
}
然后发现这一套下来,居然不管用。。。
AS还老是提示我添加google的远程仓库,没办法,就添加看看吧,结果还是一样的报错,代码如下
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta6'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
这个AS提示我添加的东西居然还是搞不定?这就让我对AS有点无语了,然后上网搜了一下,发现要改成google()才可以,这。。。
具体代码如下:
buildscript {
repositories {
jcenter()
google()
// maven {
// url 'https://maven.google.com/'
url 'https://dl.google.com/dl/android/maven2/'
// name 'Google'
// }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta6'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
QQ:361561789
有事可以直接加Q联系