简体   繁体   中英

Android Studio 3.1.3 Error : Unable to resolve dependency

I am going to develop Android on my company.

I downloaded Android Studio 3.1 and created a new blank project I get an error.

Gradle download will cause an unconditional error.

I referenced a lot of Google stuff, but I could not solve it.

Build 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

Please Help me

  • check if you have disabled offline mode of Android Studio.
  • Use implementation 'com.android.support:appcompat-v7:28.0.0-beta01' instead of 28.+

You won't be able to use constraintLayout with target sdk version 28

So the main culprit is

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

So please remove the constraint layout or reduce the target sdk version to 27.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM