首页 文章

无法解析':app@debug/compileClasspath'的依赖关系:无法解析com.android.support:appcompat-v7:28.0.0-rc01

提问于
浏览
6

我在新的Android工作室版本中得到以下错误基本的hello世界也没有 Build 在gradle中 . Cloud 请你帮忙 .

This is the error I am getting in new android studio version :

This is the error I am getting in new android studio version

My gradle file is as below

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "payments.com.java.payments"
        minSdkVersion 17
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

This is the logs i am getting

无法解析':app @ debug / compileClasspath'的依赖关系:无法解析com.android.support:appcompat-v7:28.0.0-rc01 . 打开文件显示详细信息无法解析':app @ debug / compileClasspath'的依赖关系:无法解析com.android.support.constraint:constraint-layout:1.1.2 . 打开文件显示详细信息无法解析':app @ debugAndroidTest / compileClasspath'的依赖关系:无法解析com.android.support.test:runner:1.0.2 . 打开文件显示详细信息无法解析':app @ debugAndroidTest / compileClasspath'的依赖关系:无法解析com.android.support.test.espresso:espresso-core:3.0.2 . 打开文件显示详细信息无法解析':app @ debugAndroidTest / compileClasspath'的依赖关系:无法解析com.android.support:appcompat-v7:28.0.0-rc01 . 打开文件显示详细信息无法解析':app @ debugAndroidTest / compileClasspath'的依赖关系:无法解析com.android.support.constraint:constraint-layout:1.1.2 . 打开文件显示详细信息无法解析':app @ debugUnitTest / compileClasspath'的依赖关系:无法解析com.android.support:appcompat-v7:28.0.0-rc01 . 打开文件显示详细信息无法解析':app @ debugUnitTest / compileClasspath'的依赖关系:无法解析com.android.support.constraint:constraint-layout:1.1.2 . 打开文件显示详细信息无法解析':app @ release / compileClasspath'的依赖关系:无法解析com.android.support:appcompat-v7:28.0.0-rc01 . 打开文件显示详细信息无法解析':app @ release / compileClasspath'的依赖关系:无法解析com.android.support.constraint:constraint-layout:1.1.2 . 打开文件显示详细信息无法解析':app @ releaseUnitTest / compileClasspath'的依赖关系:无法解析com.android.support:appcompat-v7:28.0.0-rc01 . 打开文件显示详细信息无法解析':app @ releaseUnitTest / compileClasspath'的依赖关系:无法解析com.android.support.constraint:constraint-layout:1.1.2 . 打开文件显示细节

9 回答

  • 1

    试试这个:删除你的gradle http代理C:\ Users *** . gradle \ gradle.properties

    enter image description here

  • 1

    检查您的互联网连接 . 对我来说,这只是互联网连接问题 . 如果您在代理服务器下 . 转到文件>设置>外观和行为>系统设置> HTTP代理,然后在那里输入您的代理详细信息 . 使用check connection选项验证您的连接 . 这是对我的gradle文件的引用 .

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 28
        defaultConfig {
           applicationId "com.oops.pk.birthday_card"
           minSdkVersion 23
           targetSdkVersion 28
           versionCode 1
           versionName "1.0"
           testInstrumentationRunner 
           "android.support.test.runner.AndroidJUnitRunner"  
        }
        buildTypes {
             release {
                 minifyEnabled false
                 proguardFiles getDefaultProguardFile('proguard-android.txt'), 
                 'proguard-rules.pro'
              }
         }
    }
    
    dependencies {
         implementation fileTree(dir: 'libs', include: ['*.jar'])
         implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
         implementation 'com.android.support:support-v4:28.0.0'
         implementation 'com.android.support:recyclerview-v7:28.0.0'
         implementation 'com.android.support:design:28.0.0'
         testImplementation 'junit:junit:4.12'
         androidTestImplementation 'com.android.support.test:runner:1.0.2'
         androidTestImplementation 'com.android.support.test.espresso:espresso- 
         core:3.0.2'
     }
    
  • 0

    请参阅我创建的Youtube视频作为此问题的解决方案,

    https://www.youtube.com/watch?v=ZAYtPzjDSQU&feature=youtu.be

    这就是你的Gradle看起来的样子 .

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 27
        defaultConfig {
            applicationId "payments.banamex.citi.com.banamexpayments"
            minSdkVersion 17
            targetSdkVersion 27
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:27.1.1'
        implementation 'com.android.support.constraint:constraint-layout:1.1.2'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    }
    
  • 0

    使用 :

    implementation 'com.android.support:appcompat-v7:28.+'

    .+ 将匹配任何版本的appcompat-v7:28 . 目前Google's Maven存储库中有 28.0.0-alpha1 and 28.0.0-alpha3 .

  • 0

    如果您有任何其他工作(非错误)Android Studio项目,

    您可以在 Project - app 下查看 build.gradle 的设置,并查找以下行:

    implementation 'com.android.support:appcompat-v7:***'
    

    您的工作SDK版本是否在您的工作项目中,然后替换您的

    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
    

    使用SDK版本(***)

    如果你没有任何工作(没有错误)项目,你可以尝试我的:

    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    

    希望这可以解决你的问题,因为它刚刚解决了我的问题 .

  • 0

    如果你已经检查过,你需要禁用离线模式 . 文件>设置>构建,执行和部署> Gradle - 取消选中离线模式并应用 .

    此外,请检查您的互联网连接 .

  • 0

    我在中国使用 Shadowsocks 代理,打开 ~/.gradle/gradle.properties 并注释https主机和端口

    #systemProp.https.proxyPort=1080
    systemProp.http.proxyHost=127.0.0.1
    #systemProp.https.proxyHost=127.0.0.1
    systemProp.http.proxyPort=1080
    

    之后,再次创建新项目或再次构建项目,完成

  • 0

    我遇到了同样的错误 . 我找到了一个解决方案 . 我希望它对你有帮助 .

    转到 build.gradle(Module:app)delete

    implementation 'com.android.support:design:28.0.0-rc01'
    
  • 0

    如果不支持28版本意味着将编译版本和目标版本更改为27

相关问题