2017-05-26 72 views
1

我更新了我的android studio,我的gradle不會同步 問題它給我這些錯誤。我也使用firebase作爲授權和數據庫。我試圖刪除gradle文件和重建,但沒有奏效。任何建議,將不勝感激。Android Gradle項目同步失敗。基本功能將無法正常工作

Failed to resolve .com.android.support:support-v4:25.2.0 
Failed to resolve com.android.support.test.espresso:espresso-core:2.2.2 
Failed to resolve com.android.support:appcompat-v4:25.3.1 
Failed to resolve com.android.support:mediarouter-V7:25.2.0 

here is the build gradle for the project 

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

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.2' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
     classpath 'com.google.gms:google-services:3.0.0' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 
here is my app gradle 

    apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion '25.0.3' 
    defaultConfig { 
     applicationId "com.example.dude.sportspicks518" 
     minSdkVersion 19 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
     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.android.support:appcompat-v4:25.3.1' 
    compile 'com.google.firebase:firebase-auth:10.0.1' 
    compile 'com.google.firebase:firebase-database:10.0.1' 
    testCompile 'junit:junit:4.12' 
    compile 'com.google.android.gms:play-services:10.2.6' 
} 

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

gradle這個通常指向確切的錯誤,你可以檢查和後 –

回答

1

幾種方式來嘗試

  1. 無效高速緩存/重新啓動AS
  2. 清理項目和重建
  3. 更新 「谷歌庫」,並在Android SDK管理器 「的Android支持庫」。

如果不工作,那麼如果你想獲得的支持庫,這是正確的導入:

compile "com.android.support:support-v4:25.3.1" 

如果你的編譯API不是25,更改版本到最新的與你的編譯API。

如果您使用不兼容的版本,Android Studio應該會給您一個黃色警告。只需將鼠標懸停並使用



P/S給出的建議是:請切勿使用com.google.android.gms:play-services ..它很沉重DEX方法計數

相關問題