このリンクに従って、Android アプリに Google サインインを統合します。https://developers.google.com/identity/sign-in/android/start-integrating上記のページの最後のステップで示されているように、依存関係を含める必要があります。
compile 'com.google.android.gms:play-services-auth:8.3.0'
アプリレベルのbuild.gradleファイルで、これを実行してプロジェクトをビルドすると、次のようなエラーが表示されます。
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict.
ビルド.gradle(モジュール:app)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.brainbreaker.socialbuttons"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.google.android.gms:play-services-auth:8.3.0'
}
build.gradleファイルのコンパイル依存関係の行にcompile 'com.google.android.gms:play-services-auth:8.3.0'
エラーが表示される
すべての com.google.android.gms ライブラリは、まったく同じバージョン仕様を使用する必要があります (バージョンを混在させると、実行時クラッシュが発生する可能性があります)。バージョン 8.3.0、8.1.0 が見つかりました。例としては、com.google.android.gms:play-services-base:8.3.0 や com.google.android.gms:play-services-measurement:8.1.0 などがあります。ライブラリ、またはツールとライブラリの組み合わせの中には、互換性がないものや、バグの原因になるものがあります。このような非互換性の 1 つは、最新バージョンではない (具体的には、targetSdkVersion よりも低いバージョン) Android サポート ライブラリでコンパイルすることです。
以下はGradleビルドのメッセージです。
Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :social_buttons:generateDebugSources, :social_buttons:generateDebugAndroidTestSources, :social_buttons:compileDebugSources, :social_buttons:compileDebugAndroidTestSources]
:clean UP-TO-DATE
:app:clean
:social_buttons:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library
:app:prepareComAndroidSupportDesign2301Library
:app:prepareComAndroidSupportSupportV42301Library
:app:prepareComGoogleAndroidGmsPlayServicesAds810Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics810Library
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library
:app:prepareComGoogleAndroidGmsPlayServicesAuth830Library
:app:prepareComGoogleAndroidGmsPlayServicesBase830Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement830Library
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement810Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
:app:processDebugGoogleServices FAILED
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict.
Information:BUILD FAILED
Information:Total time: 3.49 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
このバージョンの競合を解決する方法が見つかりません。 ご協力いただければ幸いです。
ベストアンサー1
私も同じ問題を抱えていました。しかし今は解決しました。
1行削除する必要がありますapply plugin: 'com.google.gms.google-services'
「com.android.application」パッケージにはすでに同じパッケージがあるためです。