Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/190.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Gradle项目同步失败。基本功能无法正常工作_Android - Fatal编程技术网

Android Gradle项目同步失败。基本功能无法正常工作

Android Gradle项目同步失败。基本功能无法正常工作,android,Android,我更新了我的android studio,我的gradle将不同步 它给了我这些错误。我还使用firebase作为授权和数据库。我尝试过删除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 co

我更新了我的android studio,我的gradle将不同步 它给了我这些错误。我还使用firebase作为授权和数据库。我尝试过删除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'
几种尝试方法

  • 将缓存失效/重新启动为
  • 清理项目和重建
  • 在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
    。。它很重的指数法计数

    gradle一般指的是准确的误差,你能检查并公布吗