Google Play開発者サービスへのアップグレード:9.0.0エラー解決に失敗:com.google.android.gms:play-services-measurement:9.0.0


125

私は自分のbuild.gradleファイルを

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

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

そして今、私は以前には得られなかったこのエラーを受けています。

エラー:解決できませんでした:com.google.android.gms:play-services-measurement:9.0.0 ここに画像の説明を入力してください

ここに画像の説明を入力してください


2
SDK ManagerでGoogleリポジトリを更新しましたか?
CommonsWare、2016年

1
私はPOMを見るとうーん... play-services:9.0.0私のSDKには、私が表示されていないplay-services-measurement依存関係として、そして何もありません9.0.0play-services-measurement。手動で要求していますかplay-services-measurement?そうでない場合は、プロジェクトをクリーンアップgradleするか、--refresh-dependenciesスイッチを使用してコマンドラインビルドを実行して、の検索を停止してみてくださいplay-services-measurement。ただし、全体としては、「キッチンシンク」の依存関係よりも、焦点を絞った依存関係(コメント化した依存関係)を使用する方が良いでしょうplay-services
CommonsWare、2016年

1
1.私はコードのどこにもない、play-services-measurementをまったく要求していません。2.このエラーのため、「キッチンシンク」プレイサービスに切り替えました。3.これまでに行ったことのないこの更新を実行する必要があるかもしれません。
フィリップBH 2016年

1
*問題点:プロジェクト ':app'の構成中に問題が発生しました。>構成 ':app:_debugCompile'のすべての依存関係を解決できませんでした。> com.google.android.gms:play-services-measurement:9.0.0が見つかりませんでした。次の場所で検索: jcenter.bintray.com/com/google/android/gms/….0.0 / play-services-measurement-9.0.0.pom
フィリップBH

1
以下の回答で問題が解決しないと仮定すると、その依存関係(特にそのバージョン)をロードしようとしているものを特定する必要があります。play-services9.0.0以降、これは必要なくなりました。そのため、他の何かがそれを要求している必要があります。
CommonsWare 2016年

回答:


246

これは問題を解決するために発見されました。

プロジェクトレベルのGradleであなたのクラスパスが更新com.google.gms:google-services:2.1.0クラスパスにcom.google.gms:google-services:3.0.0


39
誰かがそれを見つけない場合...この変更は最上位のbuild.gradleで行う必要があります...これは私にとってはうまくいきましたが、このエラー「Missing api_key / current_key object」が発生したため、これを適用する必要がありましたソリューションstackoverflow.com/a/37317752/50730
ハビエルトロン

「属性「方向」はすでに定義されています」という古いエラーが表示されます。google-servicesクラスパスを3.0.0に更新しました。また、GCMが有効になり、追加されたサーバーAPIキーtatがgoogle-services.jsonファイルに生成されます。誰かが私を助けてもらえますか?
cgr 2016年

1
エラーは「Error:Execution failed for task ':app:processFreeDebugGoogleServices'。> Missing api_key / current_key object」に変更されました???
LemonGentry 2016年

5
敬意を表して、誰かがこの「修正」が機能する理由を正確に説明できますか?私は、元の失敗のドキュメントや主要な理由を指摘せずに、推奨を与えるだけのSO回答の品質はほとんど役に立たず、潜在的にさらに混乱を招くことがわかりました。
トムペース

それでもエラーError:Could not find com.google.android.gms:play-services-maps:9.2.0。必須:app_1:app:unspecified <a href="searchInBuildFiles"> build.gradleファイルで検索</a>
Rohit Mandiwal

27

必須:Android StudioおよびGoogle Play開発者サービスの最新バージョン

次のようにトップレベルのbuild.gradleファイルとアプリレベルのbuild.gradleファイルを更新することで、プラグインをプロジェクトに追加できます。

classpath 'com.google.gms:google-services:3.0.0'

お気に入り

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

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

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

allprojects {
    repositories {
        jcenter()
        mavenLocal()
    }
}

次に、Google Play開発者サービスの依存関係を追加する必要があります。アプリのbuild.gradle内に以下を追加します。

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

最後に

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"

    defaultConfig {
        applicationId "// set Yours"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"


    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'LICENSE.txt'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.google.android.gms:play-services-gcm:9.6.1'
    compile 'com.android.support:appcompat-v7:24.2.0'

}

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

「Google-services.jar(com.google.gms:google-services:3.0.0)をダウンロードできませんでした
Andrew S

1
そのリンクはあなたが与えたもの以外のアドバイスを提供しておらず、リンクは古くなっています。それ以来、バージョン番号はかなり変更されています。
Andrew S

@AndrewSはを提供してくださいbuild.gradle。あなたはこれを質問として尋ねることができます。
IntelliJ Amiya 2016年

@AndrewSは私の編集済みの回答を確認してください。その後clean-rebuild-gradle
IntelliJ Amiya 2016年

11

GCMはされているrebrandedFirebase使用したい場合は、クラウドメッセージング(FCM)com.google.android.gms:play-services:9.0.0この記事読んでFCMを。これはおそらく機能build.gradleしますが、プラグインを使用するようにファイルを変更します。

buildscript {
  dependencies {
    // Add this line
    classpath 'com.google.gms:google-services:3.0.0'
  }
}

4
しかし、このエラーが発生しましたError:Execution failed for task ':app:processDebugGoogleServices'. > Missing api_key/current_key object
Shajeel Afzal、

7
@ShajeelAfzalはgoogle-service.json developers.google.com/mobile/addを
raditya gumay

プロジェクトをfirebase consoleにインポートし、機能するようにgoogle-service.jsonファイルを再生成する必要がありました。プロジェクトをfirebaseにインポートし、[管理]をクリックして、上記の方法でうまくいかない場合は、新しいファイルをダウンロードできます
stepupsoftwareのポール

なぜ3.0.0なのか?それは古いバージョンではありません。私たちはすでに9.4.0にいると思います。
IgorGanapolsky

1
@IgorGanapolskyバージョン3.0.0はGradleプラグイン用、9.4.0はライブラリ用
alvinmeimoun

1

私が見つけた最も簡単な方法は、すべてに最新バージョンを使用することです。

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
//apply plugin: 'com.google.gms.google-services' //Firebase
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
compile 'com.google.firebase:firebase-auth:10.2.6'
compile 'com.google.android.gms:play-services-auth:10.2.6' //10.2.6
compile 'com.google.firebase:firebase-core:10.2.6' // used for FCM
compile 'com.google.firebase:firebase-messaging:10.2.6' // used for FCM
testCompile 'junit:junit:4.12'
//  apply plugin: 'com.google.gms.google-services'

}

説明

apply plugin: 'com.google.gms.google-services' //これを下部に追加します。

  • まず、 apply plugin: 'com.google.gms.google-services'//これを一番下に追加します。
  • 次に、これらを依存関係に追加します

    compile 'com.google.firebase:firebase-auth:10.2.6' //これが最新バージョンであることを確認します。

    compile 'com.google.android.gms:play-services-auth:10.2.6' //10.2.6最新

    compile 'com.google.firebase:firebase-core:10.2.6' // FCMに使用

    compile 'com.google.firebase:firebase-messaging:10.2.6' // FCMに使用

今日2017年5月25日最新のfirebase-auth 10.2.6があるが、同時に最新よりもplay-services-auth:9.0.0以下を使用しているとすると、どちらも接続を確立して表示できないあなたにエラー。

これがお役に立てば幸いです。


0

Gradleの文字列を次のように変更して、このトリッキーな問題を解決しました

compile 'com.google.android.gms:play-services:9.0.0' //or latest version

0

Playサービスを10.2.1以上のバージョンに変更すると、依存関係の解決に失敗し始めました。

次のmaven URLを変更すると問題が解決することがわかりました。

maven { url 'https://raw.githubusercontent.com/onepf/OPF-mvn-repo/master/' }

maven { url 'https://github.com/onepf/OPF-mvn-repo/raw/master/' }

URLの変更により、gradleまたはmavenでのキャッシュが回避され、それが解決される可能性があります。

弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.