0

I installed android studio 3.1.3 and when I tried to build a new application .. During the gradle synchronization I had a problem as in the following picture:

enter image description here

Failed to resolve: espresso-core Open File

Failed to resolve: runner Open File

Failed to resolve: monitor Open File

and that is my app(build.gradle):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.tareq.ds"
        minSdkVersion 28
        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-alpha3'
    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'
}

and that is my project(build.gradle):

buildscript {

    repositories {
        google()
        mavenCentral()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'


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

allprojects {
    repositories {
        google()
        mavenCentral()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
abolfazl bazghandi
  • 935
  • 15
  • 29
  • May be a duplicate of https://stackoverflow.com/questions/50786296/failed-to-resolve-common-open-file-gradle-build/50789855#50789855 Maybe try adding "jcenter()"? Another thing to try would be doing a build (rather than Gradle sync). I found the build error more helpful. – Tyler V Jun 17 '18 at 17:56
  • @TylerV I have tried to use Jcenter() but the same problem I have also tried to put Jcenter and maven together And every time I clean project and rebuild project but that doesn't fix my problem :( – tarek al-assah Jun 17 '18 at 18:13
  • Not sure then. Maybe trying to build will give you a more useful error message then. – Tyler V Jun 17 '18 at 18:15
  • I'm trying to install extra sdk but I don't think that will help me ... I'm a bit of confuse because of this problem – tarek al-assah Jun 17 '18 at 18:19

1 Answers1

2

Follow these steps:

  • Open Module setting for the application
  • Under dependencies, tab Click on '+' Symbol and add all the required dependencies one by one
  • Click on Apply button
Sajal Singh
  • 365
  • 1
  • 7
  • 15