Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to resolve common open file gradle.build

I have been struggling with the past 6 hours over this one error, which i am not able to resolve.I imported the project directly from nextgis github. Please identify whats wrong and how to rectify it. here'enter image description heres the screen-shot of the error

here the build.gradle file from the module which contiains the error

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '27.0.3'
    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 26
        versionCode 37
        versionName '2.5.7.1'
        buildConfigField "String", "CLIENT_ID", "\"Im6GFdPPuPM09BnvFb3EacFZyq8TpRBSAAex7JDZ\""
    }
    productFlavors {
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

repositories {
    mavenCentral()
    maven {url "https://maven.google.com"}
    maven {
        url  "http://dl.bintray.com/krazykira/maven"
    }

    google()
    jcenter()

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':maplib')
    compile 'com.4ert:easypicker:0.2.12'
    compile 'com.github.yukuku:ambilwarna:2.0.1'
    compile 'com.jzxiang.pickerview:TimePickerDialog:1.0.1'
    compile 'com.github.miguelbcr:TableFixHeaders-Wrapper:0.2.0'
    compile 'com.android.support:appcompat-v7:26.1.0'

    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:preference-v7:26.1.0'
    compile 'com.appyvet:materialrangebar:1.4'
}
like image 655
sid.s Avatar asked Jun 10 '18 17:06

sid.s


2 Answers

I was having the same issue after a git pull of a working project from one computer to another. What finally resolved it was making sure the project gradle file listed google() and had it before jcenter(). Final working form in ProjectDir/build.gradle looks like:

allprojects {
    repositories {
        google()
        jcenter()
    }
}

I am using Gradle 4.4 and the Android Studio Gradle plugin 3.1.3

Why it was working on one computer and not on the other one, I have no idea.

like image 130
Tyler V Avatar answered Oct 23 '22 11:10

Tyler V


Solved when I wrote this code in Gradle:project

 buildscript {

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


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

allprojects {
  repositories {
      google()
      jcenter()
  }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
like image 31
Waged Avatar answered Oct 23 '22 12:10

Waged