Failed to apply plugin [id 'com.android.application'] 和 Could not find com.android.tools.build:gradle:2.XX的最正確的解決方案,applyplugin

來源:互聯網
上載者:User

Failed to apply plugin [id 'com.android.application'] 和 Could not find com.android.tools.build:gradle:2.XX的最正確的解決方案,applyplugin

發現android studio是真的可愛啊,上一秒還沒問題可以build運行,下一秒就出錯。。。好,你任性,你牛逼。。

說下今天又遇到的兩個問題:Failed to apply plugin [id 'com.android.application']和Could not find com.android.tools.build:gradle:2.XX.

1.Failed to apply plugin [id 'com.android.application']. Could not create plugin of type 'AppPlugin'.
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

剛開始遇到我是有點蒙逼的,真是佩服google,每次都能讓我遇到不一樣的問題。吐槽歸吐槽,問題就得解決。

就按照提示編輯項目下的這個檔案: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

最後一行改成最新的。。這次我是線上更新的,還擔心會不會被牆,還好,一會就下完了。。如果你在這裡下載很慢的話,推薦你離線更新,至於怎麼離線更新,參考我這篇部落格:教新手一步步解決:Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to和更新gradle問題

就在我以為把gradle更新之後就沒問題啦,誰知道又出來一個更牛逼的:Error:Could not find com.android.tools.build:gradle:2.14.1.

2.Error:Could not find com.android.tools.build:gradle:2.14.1.

你讓我更新到2.14.1.然後你又說找不到!!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

  問題中只是說找不到!!也沒什麼提示。百度了下,也在stackoverflow找了下發現都是讓你把gradle版本往低了改!這個版本不合適,改成低的確實可以解決問題,向下相容嗎。但是有新的我為什麼要改成低的呢,這肯定不能解決根本問題!於是在沒有任何參照的情況下,我試了試,很好一次就成功啦。果然跟我想的一樣,這種問題嘛,只要把外掛程式什麼的都改成最新的,一般就解決問題。

你只要一步把Android Plugin Version改為最新的:2.2.0-beta3(這是目前最新的)。直接在Project Structru->Project->Android Plugin Version 中改了就好!

查看最新的Android Plugin Version:https://jcenter.bintray.com/com/android/tools/build/gradle/

查看最新的Gradle:Gradle Distributions。

 這是我配好之後的配置:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.