Android Studio - Failed to apply plugin [id 'com.android.application']

后端 未结 17 1989
故里飘歌
故里飘歌 2020-12-08 12:38

I am working on an app. In my app there is no error in code but when I try to run my project it gives following errors.

Error:(1, 1) A problem occurred e

相关标签:
17条回答
  • 2020-12-08 13:28

    you just need to change your project.gradle file. And sync your Gradle.

    dependencies {
     classpath 'com.android.tools.build:gradle:2.2.2'
    }
    
    0 讨论(0)
  • 2020-12-08 13:29

    Solved it by setting gradle version 3.2.1

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

    In Project level Gradle

    0 讨论(0)
  • 2020-12-08 13:31

    I faced the same issue in Android Studio version 3.5.3. This is how i fixed it.

    I updated the dependecy com.android.tools.build:gradle in my project level build.gradle file from a lower version to 3.5.3 as below.

    classpath 'com.android.tools.build:gradle:3.5.3'
    

    I then went ahead and edited the value of distributionUrl in gradle-wrapper.properties file as below. This file is in the directory /gradle/wrapper/ from the root of your project folder.

    distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
    
    0 讨论(0)
  • 2020-12-08 13:31

    My problem was I had czech characters (č,ú,ů,á,ó) in the project folder path.

    0 讨论(0)
  • 2020-12-08 13:34

    Updated June 24, 2020

    You need to update to the latest gradle version to solve this issue.

    Please make sure you are on the latest Android Studio

    and then update your project level build.gradle by updating this dependency

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

    It might show a popup asking your permission to update gradle, please update and it will download the latest distribution automatically and the issue will be resolved.

    Or else you can

    Get Latest Gradle 5.6.4 from here and Add it manually

    If you don't want to download it manually:

    Open YourProject > gradle > wrapper > gradle-wrapper.properties and replace

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

    With

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

    Rebuild the project or just run gradle sync again.

    0 讨论(0)
  • 2020-12-08 13:35

    I had the same issue and this is what I did and I was able to solve my issue:

    • I'm working with ShimmerAndroidAPI ( this library ) with Android Studio 3.6.1.
    • This worked well before I upgrade the Gradle and Android Studio to a new version using pop up upgrade suggestions appeared in android studio.
    • I followed the below steps as mentioned in this answer and I was able to make the project work.The steps I followed are as below.
    • Gradle file was updated from classpath 'com.android.tools.build:gradle:3.6.1' to

      classpath 'com.android.tools.build:gradle:3.1.3'

    • Then distribution URL in gradle-wrapper.properties file was updated from distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip to

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

    • Gradle was then synched.

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