Android Studio - Failed to apply plugin [id 'com.android.application']
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()
}
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.
gradle build error Plugin with id 'com.android.application' not found
You are adding plugins in wrong place.
plugins are added inside build.gradle(app) and classpaths are added inside build.gradle(project).
for example, inside build.gradle(app)
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
}
dependencies { }
}
inside build.gradle(Project)
dependencies{
classpath 'com.android.tools.build:gradle:7.1'
}
An exception occurred applying plugin request [id: 'com.android.application'] while integration Jetpack Compose
Android Gradle Plugin 7 requires Java 11.
Go to File
> Project Structure
and change JDK location to Embedded JDK
.
Failed to apply plugin [id 'com.android.library']
Well I just solved the issue by replacing
apply plugin: 'com.android.library'
with its deprecated version
apply plugin: 'android-library'
That seems to work for now, but I don't think this is the optimal solution, so I'm open to better ones.
Android Gradle Plugin 7.1.3, Plugin [id: 'com.android.application', version: '7.1.3', apply: false] was not found in any of the following sources
Android Gradle Plugin 7.1.3 has been released. Problem solved.
Project build files are up-to-date for Android Gradle Plugin version 7.1.3.
Failed to apply plugin [id 'com.android.application'] - Minimum supported Gradle version is 4.4
Default gradle pointer wrong. During update, Android Studio ffailed to update the symlink for gradle:
/usr/local/bin/gradle
Once I manually updated
ln -s /Users/userx/.gradle/wrapper/dists/gradle-4.4-all/9br9xq1tocpiv8o6njlyu5op1/gradle-4.4/bin/gradle /usr/local/bin/
all builds started working again.
Android Gradle Plugin: Plugin [id: 'com.android.application', version: '7.1.3', apply: false] was not found in any of the following sources
On Windows, Adding Android Studio to the Windows Firewall list fixed the same problem for me. It wasn't added by default, or maybe I clicked something wrong during installation.
- Start > Windows Firewall
- In the left panel "Allow an app for feature through Windows Firewall"
- Change settings
- If Android Studio is not in the list: "Allow another app" and find the exe from the desktop/start menu shortcut
- I restarted windows; maybe restarting Android Studio is enough
There are probably many causes/solutions for this error, but this worked for me.
Related Topics
Android Blur View (Blur Background Behind the View)
How to Customize Chart Labels for Mpandroidchart Library
How to Close All Activities and Exit from an App
Setting Webview to View Desktop Site and Not Mobile Site
Prevent Other Applications Form Capturing/Recording Screen
Android: How to Send an Image as Email Attachment from Application
How to Get the Full File Path from Uri
Viewmodel Onchange Gets Called Multiple Times When Back from Fragment
Getcontactsfromfirebase() Method Return an Empty List
How to Keep a Bottom Nav Bar from Being Pushed Up on Keyboard Shown
How to Execute Code When Application Is Closing
Sending Files Using Post With Httpurlconnection
Possible Unhandled Promise Rejection (Id:0) Error: Network Error in React Native
How to Make Service That Is Unremovable Even If Killed by the System
How to Execute Adb Commands Through My Android App
How to Get the Json Response of a Post Request in a Webview
How to Post Raw Whole Json in the Body of a Retrofit Request