2

enter image description here

I am getting this error while running a code in Android, this is about gradle but I already have added this thing in the build.gradle

repositories {
        jcenter()
        google()

    }

Please help thanks in advance

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "27.0.3"
        minSdkVersion = 16
        compileSdkVersion = 27
        targetSdkVersion = 26
        supportLibVersion = "27.1.1"
    }
    repositories {
        jcenter()
        google()

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.+' // <- USE 2.2.+ version
    }
}

allprojects {
    repositories {
        // Add jitpack repository (added by tipsi-stripe)
        maven { url "https://jitpack.io" }
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        google()
    }
}


task wrapper(type: Wrapper) {
    gradleVersion = '4.4'
    distributionUrl = distributionUrl.replace("bin", "all")
}

This is my build gradle where it is saying there is a problem in line 13

6
  • android/build.gradle line 13, please share your build.gradle because it says that the error is at line 13 of it. Commented Nov 22, 2018 at 4:37
  • Hello Cristian Please check the question I have uploaded the build.gradle Commented Nov 22, 2018 at 4:39
  • Check your gradle-wrapper.properties file and change distributionUrl to distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip and try again Commented Nov 22, 2018 at 4:44
  • I have changed it but still getting error prntscr.com/llfc9t please check Commented Nov 22, 2018 at 4:46
  • 1
    Remove the last line with 2.14 Commented Nov 22, 2018 at 4:48

1 Answer 1

1

Check your gradle-wrapper.properties file and change distributionUrl to

distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip

Sign up to request clarification or add additional context in comments.

6 Comments

btw you need to remove this from your gradle file dependencies { classpath 'com.android.tools.build:gradle:2.2.+' // <- USE 2.2.+ version } for the error I would need to see your app/build.gradle but that's something for another question I guess.
I have kept it in comment but still the error is coming prntscr.com/llfgth
yes that's unrelated, I said because It could cause another problems and you wouldn't know, it conflicts with the other declaration
So what to do now?
You need to post another question for that, I would suggest to also add your app/build.gradle to that question, I know it's a burden but it's just the rules of SO, comments are not for this. Don't worry, you are on the right track.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.