未能解析:com.android.support:appcompat-v7:27.0.2

未能解析:com.android.support:appcompat-v7:27.0.2,android,gradle,Android,Gradle,我厌倦了在android studio中解决这个错误。我真的浪费了两天的宝贵时间来解决这个愚蠢的错误。伙计们,请帮我摆脱这种局面。不要认为我留下了任何链接,所以我没有尝试。但是没有运气 我正在使用android studio 2.3.3 我的根级别渐变文件如下所示:- buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tool

我厌倦了在android studio中解决这个错误。我真的浪费了两天的宝贵时间来解决这个愚蠢的错误。伙计们,请帮我摆脱这种局面。不要认为我留下了任何链接,所以我没有尝试。但是没有运气

我正在使用android studio 2.3.3

我的根级别渐变文件如下所示:-

    buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
  apply plugin: 'com.android.application'
    android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.myAppId"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

    repositories {
    mavenCentral()
}

    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-v7:25.2.0'
    compile 'com.android.support:recyclerview-v7:25.2.+'
    compile 'com.android.support:design:25.2.0'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.squareup.retrofit2:retrofit:2.0.2'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'
    compile 'com.squareup.retrofit2:converter-scalars:2.3.0'
    compile 'com.google.android.gms:play-services-location:9.2.1'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.google.android.gms:play-services-auth:9.2.1'
    testCompile 'junit:junit:4.12'
    compile files('libs/ormlite-android-4.43.jar')
    compile files('libs/ormlite-core-4.43.jar')
    compile files('libs/universal-image-loader-1.9.5.jar')
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.androidanimations:library:1.0.3@aar'
    compile 'in.srain.cube:grid-view-with-header-footer:1.0.12'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:palette-v7:25.2.0'
    compile 'com.github.jd-alexander:LikeButton:0.2.1'
    compile 'com.github.techery:properratingbar:0.0.5'
    compile 'com.github.GoodieBag:Pinview:v1.3'
    compile project(':library')
}
apply plugin: 'com.google.gms.google-services'
我的应用程序构建如下所示:-

    buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
  apply plugin: 'com.android.application'
    android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.myAppId"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

    repositories {
    mavenCentral()
}

    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-v7:25.2.0'
    compile 'com.android.support:recyclerview-v7:25.2.+'
    compile 'com.android.support:design:25.2.0'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.squareup.retrofit2:retrofit:2.0.2'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'
    compile 'com.squareup.retrofit2:converter-scalars:2.3.0'
    compile 'com.google.android.gms:play-services-location:9.2.1'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.google.android.gms:play-services-auth:9.2.1'
    testCompile 'junit:junit:4.12'
    compile files('libs/ormlite-android-4.43.jar')
    compile files('libs/ormlite-core-4.43.jar')
    compile files('libs/universal-image-loader-1.9.5.jar')
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.androidanimations:library:1.0.3@aar'
    compile 'in.srain.cube:grid-view-with-header-footer:1.0.12'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:palette-v7:25.2.0'
    compile 'com.github.jd-alexander:LikeButton:0.2.1'
    compile 'com.github.techery:properratingbar:0.0.5'
    compile 'com.github.GoodieBag:Pinview:v1.3'
    compile project(':library')
}
apply plugin: 'com.google.gms.google-services'
My gradle-wrapper.properties:-

 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
 distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
我正在使用构建工具版本as 25.0.2。我不知道为什么它会给我27.0.2的错误

我面临以下错误:-


请尝试将
编译
替换为
实现
。
比如

希望这会有所帮助

有关更多更新,您可以通过以下步骤:

未能解析:com.android.support:appcompat-v7:27.0.2

google()
存储库添加到项目级
build.gradle
文件中的两个
repositories
闭包中

实际上,由于您使用的是旧版本的工具,因此需要使用此工具,而不是
google()

我不知道为什么它会给我27.0.2的错误

一个或多个依赖项要求27.0.2。例如,
compile'com.facebook.android:facebook-android-sdk:[4,5)
将为您提供该库的不确定版本,该版本可能需要27.0.2版本的支持库。

获得了解决方案。 只是 替换

compile 'com.facebook.android:facebook-android-sdk:[4,5)'


我认为您的android studio Gradle设置“脱机工作”已启用。您需要禁用此设置,它将正常工作

为此: 1.Android studio首选项->构建、执行、部署->渐变
2.取消选中“脱机工作”

如果有使用27.0.2的库,则会出现错误。问题是您没有使用最新的android版本和构建工具,但您的一些库正在使用。因此,您无法同步gradle文件。请删除这些库或将gradle更新为最新版本的android1。避免使用using+登录gradle依赖项使用compile'com.android.support:recyclerview-v7:25.2.0'而不是compile'com.android.support:recyclerview-v7:25.2.+'2.更新gradle版本和android studio。
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.facebook.android:facebook-android-sdk:4.26.0'