Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find com.andorid.tools.build:gradle:3.0.0-beta2

I am not able to solve the issue of associated with the gradle file.For Solving this issue i have downloaded the android studio 3.0 beta 6, in which the project is not builded. And in Android studio 2.3.2 following issue came

top level gradle

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta6'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.0'
        classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://maven.google.com" }
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

issues

Error:Could not find com.android.tools.build:gradle:3.0.0-beta2.
Searched in the following locations:
    file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-beta2/gradle-3.0.0-beta2.pom
    file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-beta2/gradle-3.0.0-beta2.jar
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-beta2/gradle-3.0.0-beta2.pom
    https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-beta2/gradle-3.0.0-beta2.jar
    https://repo1.maven.org/maven2/com/android/tools/build/gradle/3.0.0-beta2/gradle-3.0.0-beta2.pom
    https://repo1.maven.org/maven2/com/android/tools/build/gradle/3.0.0-beta2/gradle-3.0.0-beta2.jar
Required by:
    project :

EDIT:
Just added the google maven repo:

top level gradle

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven { url "https://maven.google.com" }
    }
    dependencies {
//        classpath 'com.android.tools.build:gradle:3.0.0-beta6'

        classpath 'com.android.tools.build:gradle:3.0.0-beta6'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.0'
        classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
    }
}

//allprojects {
//    repositories {
//        jcenter()
//        maven { url "https://maven.google.com" }
//        maven { url 'https://jitpack.io' }
//    }
//}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Gradle wrapper

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

enter image description here

EDIT:
Just after uncommenting the allproject block

error enter image description here How can this issue be solved? I have watched many solution on stack but not able to solve this issue

like image 747
Ghimire Avatar asked Sep 20 '17 11:09

Ghimire


2 Answers

repositories {
   jcenter()
   ...
   // You need to add the following repository to download the
   // new plugin.
   maven { url "https://maven.google.com" } //THIS
   google() //OR THIS
}

Also delete .gradle and gradle folder and resync the project. Issues with caches

like image 152
Niroj Shr Avatar answered Oct 23 '22 21:10

Niroj Shr


You have to add the maven google also in the buildscript block in the top-level build.gradle file:

buildscript {
    repositories {
       jcenter()
       ...
       // You need to add the following repository to download the
       // new plugin.
       maven { url "https://maven.google.com" }
    }
   dependencies {
       classpath 'com.android.tools.build:gradle:3.0.0-beta6'
       //...
   }
}

This version of the plugin also requires an update version of gradle. You have to update the distributionUrl in gradle-wrapper.properties as follows:

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

More info about the plugin 3.0.x here.

like image 27
Gabriele Mariotti Avatar answered Oct 23 '22 22:10

Gabriele Mariotti