1. 程式人生 > >https://maven.google.com studio3.0問題

https://maven.google.com studio3.0問題

最近都在接觸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聯絡