问题
While setting compile 'com.google.android.gms:play-services-appindexing:10.0.0'
it is giving following error:
Error:(82, 13) Failed to resolve: com.google.android.gms:play-services-appindexing:10.0.0
and while setting compile 'com.google.android.gms:play-services-appindexing:9.8.0'
it is giving following error:
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.0.0.
It would be grateful if someone can tell me whats wrong with this because rest play services version 10.0.0 working fine.
my build.gradle file
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.22.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
signingConfigs {
}
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.example.app"
minSdkVersion 15
targetSdkVersion 25
versionCode 41
versionName "2.2.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
debug {
signingConfig signingConfigs.config
}
}
lintOptions {
checkReleaseBuilds false
}
}
configurations {
compile.exclude group: 'stax'
compile.exclude group: 'xpp3'
}
repositories {
maven {
url "http://dl.bintray.com/microsoftazuremobile/SDK"
}
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
//Microsoft azure
compile 'com.microsoft.azure:azure-notifications-handler:1.0.1@aar'
compile files('libs/notification-hubs-0.4.jar')
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:cardview-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:palette-v7:25.0.1'
compile 'com.google.android.gms:play-services-auth:10.0.0'
compile 'com.google.android.gms:play-services-maps:10.0.0'
compile 'com.google.android.gms:play-services-analytics:10.0.0'
compile 'com.google.android.gms:play-services-gcm:10.0.0'
compile 'com.google.android.gms:play-services-appindexing:10.0.0'
compile 'com.google.android.gms:play-services-base:10.0.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.android.support:multidex:1.0.1'
//Facebook SDK
compile 'com.facebook.android:facebook-android-sdk:4.17.0'
}
apply plugin: 'com.google.gms.google-services'
回答1:
The appindexing library you are looking for is now under a new gradle target.
You want to add compile 'com.google.firebase:firebase-appindexing:10.0.0'
to your app's build.gradle
file :)
You can see the up-to-date libraries here.
回答2:
Now Google Play Services Version 10.0.1 has released so replace this
compile 'com.google.android.gms:play-services-appindexing:10.0.0'
by compile 'com.google.firebase:firebase-appindexing:10.0.1'
回答3:
Hi, anytime you come across this type of error, the first thing to do is usually to check if you have the latest version of google repository installed in your Android Studio. I had the same issue and after updating as everything works fine. Hope it helps.
回答4:
I had to do two things. Add:
compile 'com.google.firebase:firebase-appindexing:10.0.0'
which apparently is new. This API is now listed as a sole firebase API among all the Google Play services setup APIs here. Also REMOVE the play-services-appindexing
compile this API replaces:
//no longer include 'play-services-appindexing' compile
//compile 'com.google.android.gms:play-services-appindexing:10.0.0
I had removed the play-services-ads
compile when first installing firebase services months ago, as instructed by docs, although including it does not crash the project compile like including play-services-appindexing
now does.
On uploading the release apk, I found three permissions unfortunately now added to my required permissions after upgrading my sdks and adding the firebase-appindexing
compile. These were not in my manifest:
android.permission.READ_EXTERNAL_STORAGE,
android.permission.READ_PHONE_STATE, and
android.permission.WRITE_EXTERNAL_STORAGE
Edit 12/9/16: As commented by Gaurav, play-services version 10.0.1
has eliminated the added 'dangerous' permissions of READ_PHONE_STATE, READ_EXTERNAL_STORAGE, and WRITE_EXTERNAL_STORAGE,
resulting I expect from a manifest merge in version 10.0.0.
These permissions call a special dialogue box that can discourage your users from continuing with your app ('Is this game trying to take over my phone?'). If you use firebase compiles, be sure to upgrade all of those to 10.0.1
too. They won't be grayed out like the play-services compiles, an unfortunate inconsistency in the app gradle upgrade warnings. If you neglect to upgrade the firebase compiles to match the play-services compiles you get the infamous 'cannot access zzanb after using play-services' project compile crash - Firebase Error cannot access zzanb after using play-services-xxx:9.8.00.
来源:https://stackoverflow.com/questions/40732418/failed-to-resolve-com-google-android-gmsplay-services-appindexing10-0-0