Gradle project sync fail, no toolchains

前端 未结 5 989
借酒劲吻你
借酒劲吻你 2021-01-18 23:29

Hello I\'m getting this error in android studio :

Gradle project sync failed. Basic functionality (editing, debugging) will not work properly

And in messages

5条回答
  •  伪装坚强ぢ
    2021-01-19 00:05

    First

    open build.gradle(module:app) app file and make following changes in it.

    • replace compile(if present) with api wherever api ref. like: volley, GitHub dependancy.strong text is used and
    • replace compile (if present) with implementation incase of using android libraries like play-services-maps,appcompat-v7 etc.

    example: old way

      dependencies {
         testCompile'junit:junit:4.12'
        compile 'com.android.volley:volley:1.1.0' 
    

    Change it to:

     dependencies {
        testImplementation 'junit:junit:4.12'
        implementation 'com.android.volley:volley:1.1.0'
    

    Then,

    open build.gradle (Project: yourproject) file * and change the google gms services to the latest

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

    Then,

    • Open gradle-wrapper.properties file and replace it with following:
    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    

    Perform gradle sync and then Rebuild the project.

提交回复
热议问题