2017-05-26 159 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方法计数

相关问题