解決Error:Unable to find method 'org.gradle.api.internal.project.ProjectInternal.


錯誤描述
今天在Github上面下載了一份代碼,然后導入到Android Studio中直接報錯誤

錯誤描述如下:

Error: Unable to find method ‘org.gradle.api.internal.project.ProjectInternal.getPluginManager()Lorg/gradle/api/internal/plugins/PluginManagerInternal;’.
Possible causes for this unexpected error include:



差異一:gradle版本太低
發現該代碼的gradle版本為1.2.3,代碼如下

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

因為gradle版本為1.2.3我電腦上沒有下載,因此我將gradle版本改為我目前Android Studio中所使用的gradle版本,代碼如下:
   Build.gradle

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

差異二:gradle-wrapper.properties里面的gradle壓縮包版本太低
發現了項目工程文件目錄gradle\wrapper里面找到gradle-wrapper.properties里面的內容不同。


修改里面的值:

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

 

改為distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip


修改后如下:

#Sun Mar 01 14:29:55 CST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

 




免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM