2017-02-28 31 views
2

Error:(41, 13) Failed to resolve: com.google.android.gms:play-services-appindexing:10.0.1我突然得到了Play-Service-app-indexing:Android Studio的Gradle中的10.0.1錯誤

這是我在Android Studio中項目的build.gradle文件,錯誤突然出現了。

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 25 
buildToolsVersion "25.0.1" 
defaultConfig { 
    applicationId "com.example.pandey.nidhiiot" 
    minSdkVersion 16 
    targetSdkVersion 25 
    versionCode 1 
    versionName "1.0" 
    multiDexEnabled true 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 

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' 
}) 
compile 'com.google.android.gms:play-services:10.0.1' 
compile 'com.github.bumptech.glide:glide:3.7.0' 
compile 'com.google.android.gms:play-services:10.0.1' 
compile 'com.google.firebase:firebase-core:10.0.1' 
compile 'com.android.support:appcompat-v7:25.1.1' 
compile 'com.android.support:design:25.1.1' 
compile 'com.google.firebase:firebase-appindexing:10.0.0' 
testCompile 'junit:junit:4.12' 
apk 'com.google.android.gms:play-services:10.0.1' 
compile 'com.google.firebase:firebase-appindexing:10.0.1' 
compile fileTree(include: ['*.jar'], dir: 'libs') 
compile 'com.android.support:support-v4:25.1.1-beta1' 
// Glide image library 
compile 'com.github.bumptech.glide:glide:3.7.0' 
compile 'com.google.android.gms:play-services-appindexing:10.0.1' 

    } 

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

嘗試編譯到位APK –

+0

的,你需要編譯你希望這些依賴關係。編譯'com.google.android.gms:play-services-auth:10.0.0' compile'c​​om.google.android.gms:play-services-maps:10.0.0' compile'c​​om.google.android。 gms:play-services-analytics:10.0.0' compile'c​​om.google.android.gms:play-services-gcm:10.0.0' compile'c​​om.google.android.gms:play-services-appindexing: 10.0.0' compile'c​​om.google.android.gms:play-services-base:10.0.0'這是不同的依賴關係 –

+0

未解決錯誤已經jst bcame幾乎山姆從10.0.1到10.0.0 :( –

回答

0

參考該post,你應該刪除

compile 'com.google.android.gms:play-services-appindexing:10.0.1' 

因爲使用新庫的依賴(下)應該是足夠的。

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

我複製了你的gradle文件的依賴部分,遇到同樣的情況。刪除重複項(compile 'com.google.android.gms:play-services:10.0.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' 
    }) 
    compile 'com.github.bumptech.glide:glide:3.7.0' 
    compile 'com.google.android.gms:play-services:10.0.1' 
    compile 'com.google.firebase:firebase-core:10.0.1' 
    compile 'com.android.support:appcompat-v7:25.1.1' 
    compile 'com.android.support:design:25.1.1' 
    compile 'com.google.firebase:firebase-appindexing:10.0.1' 
    testCompile 'junit:junit:4.12' 
    apk 'com.google.android.gms:play-services:10.0.1' 
    compile 'com.google.firebase:firebase-appindexing:10.0.1' 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile 'com.android.support:support-v4:25.1.1-beta1' 
    // Glide image library 
    compile 'com.github.bumptech.glide:glide:3.7.0' 

} 
+0

非常感謝你的幫助 –

0

你有

compile 'com.google.firebase:firebase-appindexing:10.0.0' 
compile 'com.google.android.gms:play-services-appindexing:10.0.1' 

檢查只是其中之一是必須的。 還要檢查改變火力,appindexing到10.0.1

+0

嘗試兩者都沒有解決 –

0

試試這個可能是有幫助

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 25 
buildToolsVersion "25.0.1" 
defaultConfig { 
applicationId "com.example.pandey.nidhiiot" 
minSdkVersion 16 
targetSdkVersion 25 
versionCode 1 
versionName "1.0" 
multiDexEnabled true 
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
} 
buildTypes { 
release { 
    minifyEnabled false 
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
    } 
} 

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' 
}) 
    compile 'com.google.android.gms:play-services:10.0.1' 
    compile 'com.github.bumptech.glide:glide:3.7.0' 
    compile 'com.google.android.gms:play-services:10.0.1' 
    compile 'com.google.firebase:firebase-core:10.0.1' 
    compile 'com.android.support:appcompat-v7:25.1.1' 
    compile 'com.android.support:design:25.1.1' 
    compile 'com.google.firebase:firebase-appindexing:10.0.0' 
    compile 'com.google.android.gms:play-services:10.0.1' 
    compile 'com.google.android.gms:play-services-appindexing:10.0.1' 
    compile 'com.google.firebase:firebase-appindexing:10.0.1' 
    compile 'com.android.support:support-v4:25.1.0' 
    testCompile 'junit:junit:4.12' 
// Glide image library 
    compile 'com.github.bumptech.glide:glide:3.7.0' 


    } 

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