8.4.0 へのアップデートでバージョン競合 質問する

8.4.0 へのアップデートでバージョン競合 質問する

エラー:

タスク ':app:processDebugGoogleServices' の実行に失敗しました。google-services プラグインのバージョンを更新するか、バージョンの競合を修正してください (最新バージョンに関する情報はこちらから入手可能) または com.google.android.gms のバージョンを 8.3.0 に更新します。

見つけたものはすべてやりました。

  dependencies {
            // This does not break the build when Android Studio is missing the JRebel for Android plugin.
            classpath 'com.zeroturnaround.jrebel.android:jr-android-gradle:1.0.+'
            classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
            classpath 'com.google.gms:google-services:2.0.0-alpha3'

            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }

そしてアプリのGradleでは

    compile 'com.google.android.gms:play-services:8.4.0'

ベストアンサー1

プロジェクトのbuild.gradleにこれらの依存関係を使用します

dependencies {
    classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
    classpath 'com.google.gms:google-services:2.0.0-alpha3'
}

これをアプリレベルの build.gradle ファイルの最後 (依存関係の後) に配置します。

apply plugin: 'com.google.gms.google-services'

これを最後 (最初ではなく) に置くとエラーが解決される理由がわかりません。

編集 2016年5月1日

わかりました…皆さんが直面しているすべての問題を私の解決策で終わらせようとしています

これは私の最終的なアプリレベルのGradleです

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "your-app-name"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    jcenter()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.android.support:design:23.1.1'
    compile 'com.mcxiaoke.volley:library:1.0.6@aar'
}

apply plugin: 'com.google.gms.google-services'

これは私の最終プロジェクトレベルのGradleです

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
        classpath 'com.google.gms:google-services:2.0.0-alpha3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

これを自分の Gradle ファイルと比較し、私が書いたものと異なる値を追加または変更してください。

おすすめ記事