2016-11-22 52 views
26

雖然設置compile 'com.google.android.gms:play-services-appindexing:10.0.0'它給以下錯誤:無法解析:`com.google.android.gms:發揮服務-appindexing:10.0.0`

Error:(82, 13) Failed to resolve: com.google.android.gms:play-services-appindexing:10.0.0 

,並在設置compile 'com.google.android.gms:play-services-appindexing:9.8.0'它給以下錯誤:

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. 

如果有人能告訴我這是什麼錯誤,因爲休息播放服務版本10.0.0工作正常,將不勝感激。

我的build.gradle文件

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:[email protected]' 
    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' 
+0

這是奇怪..:思考:。你有更新你的SDK嗎? –

+0

你可以發佈你的build.gradle在你的佇列裏嗎?這將有助於理解您的問題 –

+0

同時檢查您是否在您的gradle級別添加了** classpath'com.google.gms:google-services:3.0.0'**或不是 –

回答

25

現在,谷歌Play服務版本10.0。1已經發布了這樣替換此 compile 'com.google.android.gms:play-services-appindexing:10.0.0'

通過​​

34

你正在尋找的appindexing庫現在是一個新的目標的gradle下。

您要添加compile 'com.google.firebase:firebase-appindexing:10.0.0'到您的應用程序的文件的build.gradle :)

可以看到了最新的庫,在這裏:https://firebase.google.com/docs/android/setup#available_libraries

+1

這隻如果操作使用火力點,則工作。我立場糾正。 –

+0

但是,如果我們在這裏檢查https://developers.google.com/android/guides/setup,他們已經支持com.google.android.gms:play-services-appindexing:10.0.0 –

+0

感謝您指出。該頁面已更新以顯示名稱更改。之前的API仍然可用於此新的Gradle目標,因此不需要更改代碼,除非更改構建目標並將Firebase添加到項目中。 –

12

嗨,任何時候你遇到這種類型的錯誤,首先要做的通常是檢查您的Android Studio中是否安裝了最新版本的Google存儲庫。我有同樣的問題,更新後,一切正常。希望能幫助到你。

+0

準確的問題,我有:) – ZimaXXX

+0

我剛剛檢查出來。它的更新,但仍然有相同的問題 –

+0

謝謝你@ O'Kamiye – Micle

4

我必須做兩件事情。 地址:

compile 'com.google.firebase:firebase-appindexing:10.0.0' 

這顯然是新的。此API現在被列爲所有Google Play服務設置API中的唯一Firebase API,此處爲https://developers.google.com/android/guides/setup。同時刪除了「發揮服務-appindexing」編譯這個API取代:

//no longer include 'play-services-appindexing' compile 
//compile 'com.google.android.gms:play-services-appindexing:10.0.0 

我幾個月前刪除「播放服務的廣告」編譯初次安裝火力的服務,通過文檔的指示,儘管包括它不會像現在包括'play-services-appindexing'一樣崩潰項目編譯。

在上傳發布APK,我發現了三個權限可惜現在加入到我的權限提升我的SDK和加入「火力-appindexing」編譯後。這些不在我的清單中:android.permission.READ_EXTERNAL_STORAGE,android.permission.READ_PHONE_STATE和android.permission.WRITE_EXTERNAL_STORAGE

編輯12/9/16:由Gaurav評論,play-services版本10.0.1已經消除READ_PHONE_STATE,READ_EXTERNAL_STORAGE和WRITE_EXTERNAL_STORAGE的增加「危險」的權限,導致我從10.0.0版本清單合併預期。這些權限會調用一個特殊的對話框,阻止用戶繼續使用您的應用程序('這個遊戲試圖接管我的手機嗎?')。如果您使用Firebase編譯,請務必將所有這些升級到10.0.1。它們不會像遊戲服務編譯一樣變成灰色,這是應用程序gradle升級警告中的一個不幸的不一致。如果你忽視升級firebase編譯以匹配play-services編譯,你會得到臭名昭着的'使用play-services'項目編譯失敗後無法訪問zzanb - Firebase Error cannot access zzanb after using play-services-xxx:9.8.00

+1

你是對的,它現在是'firebase-appindexing',我也不得不改變實現代碼。請參閱:https://github.com/googlecodelabs/app-indexing –

+1

我也必須更改實施代碼。 顯然你現在必須指定一個索引對象和一個動作對象。 非常混亂。特別是因爲索引對象只需要添加一次(我想跟蹤添加的索引)和每次用戶執行操作時的操作對象。 出於某種原因,我不會在谷歌搜索工具欄中得到任何結果。 –

+1

我想用10.0.1解決新添加的權限問題。讓我們知道你的經驗。 –

相關問題