Android Studio: Could not find com.android.tools.build:gradle:2.0.0-alpha2

后端 未结 8 2201
温柔的废话
温柔的废话 2020-12-16 09:01

Recently I have updated my Android Studio to latest version from Latest Android Studio Canary Build: 2.0 Preview

After updating to the new version, my current workin

相关标签:
8条回答
  • 2020-12-16 09:29

    In the main build.gradle file, add jcenter() as main repo, just like that :

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:1.5.0'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            jcenter()
        }
    }
    

    Remove other repositories or make sure jcenter is the first one.

    0 讨论(0)
  • 2020-12-16 09:29

    I have tried something like

    platfoms > android > cordova >lib > builders > Gradlebuilder.js

    Downloaded zip and given path

    var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'file\:///C:/MyPC/Documents/softwares/gradle-2.14.1-all.zip';
    

    and linking path is

    allprojects {
        repositories {
            mavenLocal()
    
            google()
            jcenter()
             maven{url "http://jcenter.bintray.com"}
        }
    }
    

    It worked for me.

    • this is for Ionic developers *
    0 讨论(0)
  • 2020-12-16 09:34

    I removed the newest folder gradle-4.1-all in C:\Users\YOUR_USER_NAME\ .gradle\wrapper\dists\ and then I created a new project in Android Studio and the following message disappeared:

    "Gradle sync failed: Could not find com.android.tools.build: Gradle: 3.0.0-beta6. "

    0 讨论(0)
  • 2020-12-16 09:37
    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.3.3'
            classpath 'com.google.gms:google-services:3.0.0'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            maven { url "https://maven.google.com" }
            maven { url "https://jitpack.io" }
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
    0 讨论(0)
  • 2020-12-16 09:41
    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.3.0'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    repositories block should be in buildscript. 
    
    0 讨论(0)
  • 2020-12-16 09:49

    Check to see if gradle 2.0.0-alpha1 is available on your system. Look in your android/tools/build/gradle folder. In my case, despite the confusing message "This project is using a preview version of the Gradle plugin (2.0.0-alpha2) and a newer version is available (2.0.0-alpha2) You can update to 2.0.0-alpha2." the version in my folder was 2.0.0-alpha1, and changing my build.gradle to: classpath 'com.android.tools.build:gradle:2.0.0-alpha1' fixed my build problem.

    0 讨论(0)
提交回复
热议问题