Failed to apply plugin [id 'com. android. application'] And cocould not find com. android. tools. build: gradle: 2. XX. applyplugin
Android studio is really cute. You can build and run it in the last second, and an error will occur in the next second... Good, you are willful, you are awesome ..
Let's talk about the two problems we encountered today: Failed to apply plugin [id 'com. android. application'] And cocould not find com. android. tools. build: gradle: 2. XX.
1. Failed to apply plugin [id 'com. android. application']. cocould not create plugin of type 'apppugin '.
Error:(1, 1) A problem occurred evaluating project ':eventactiondispatcher'.> Failed to apply plugin [id 'com.android.application']> Could not create plugin of type 'AppPlugin'. If using the gradle wrapper, try editing the distributionUrl in D:\as_workspace\RecyclerView\gradle\wrapper\gradle-wrapper.properties to gradle-2.14.1-all.zip
At the beginning, I was a little overwhelmed. I really admire google. Every time I encountered a different problem. The problem has to be solved.
Follow the prompts to edit this file under the project: gradle \ wrapper \ gradle-wrapper.properties.
#Mon Dec 28 10:00:20 PST 2015distributionBase=GRADLE_USER_HOMEdistributionPath=wrapper/distszipStoreBase=GRADLE_USER_HOMEzipStorePath=wrapper/distsdistributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
Change the last line to the latest one .. I updated it online this time and worried about whether it would be blocked. Fortunately, it will be over soon .. If downloading is slow here, we recommend that you update offline. For how to update offline, refer to my blog: how to solve this problem step by step: Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to and update gradle
I thought it would be okay after I updated gradle. Who knows that there is another awesome one: Error: cocould not find com. android. tools. build: gradle: 2.14.1.
2. Error: cocould not find com. android. tools. build: gradle: 2.14.1.
You asked me to update it to 2.14.1. Then you said you couldn't find it !! Fuck !!
rror:Could not find com.android.tools.build:gradle:2.14.1.Searched in the following locations: file:/D:/Tools/android_studio2.1stable/gradle/m2repository/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.pom file:/D:/Tools/android_studio2.1stable/gradle/m2repository/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.jarhttps://jcenter.bintray.com/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.pomhttps://jcenter.bintray.com/com/android/tools/build/gradle/2.14.1/gradle-2.14.1.jarRequired by: :RecyclerView:unspecified
The problem is that it cannot be found !! There are no prompts. I found it in stackoverflow and found that the gradle version was changed to a lower version! This version is not suitable. changing it to a lower version can solve the problem. Is it backward compatible. But why should I change it to a lower level? This certainly cannot solve the fundamental problem! So without any reference, I tried it and it was a good time to succeed. As I think, if you change the plug-ins to the latest version, the problem is generally solved.
You only need to change the Android Plugin Version to the latest Version: 2.2.0-beta3 (this is the latest Version ). Change it directly in Project Structru-> Project-> Android Plugin Version!
View the latest Android Plugin Version: https://jcenter.bintray.com/com/android/tools/build/gradle/
View the latest Gradle: Gradle Distributions.
Here is the configuration after my Configuration: