【问题标题】:Android Studio 3.1.3 Error : Unable to resolve dependencyAndroid Studio 3.1.3 错误:无法解决依赖关系
【发布时间】:2018-08-06 08:54:24
【问题描述】:

我打算在我的公司开发 Android。

我下载了 Android Studio 3.1 并创建了一个新的空白项目,但出现错误。

Gradle 下载会导致无条件错误。

我参考了很多谷歌的东西,但我无法解决。

构建等级:

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

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.fouad.kurd"
        minSdkVersion 18
        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.+'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

gradle.wrapper.properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

:( Error Screen shot

请帮帮我

【问题讨论】:

    标签: android android-studio gradle android-gradle-plugin build.gradle


    【解决方案1】:

    您将无法在目标 sdk 版本 28 中使用 constraintLayout

    所以罪魁祸首是

    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    

    所以请移除约束布局或将目标sdk版本降低到27。

    【讨论】:

      【解决方案2】:
      • 检查你是否有disabled offline mode的Android Studio。
      • 使用implementation 'com.android.support:appcompat-v7:28.0.0-beta01' 而不是28.+

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-05-09
        • 2016-03-06
        • 2018-04-22
        • 2016-09-03
        • 2023-02-08
        • 2019-01-07
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多