Android Studio Gradle Configuration Errors總結

1. java

Console代碼   收藏代碼
  1. Error:Configuration with name 'default' not found.  

 這樣的錯誤乍看無從下手,可是gradle提供了一個命令能夠進一步地定位具體的錯誤 android

Cmd代碼   收藏代碼
  1. gradlew.bat assembleDebug --info  

 此時將獲取到進一步的錯誤信息,好比個人 app

Console代碼   收藏代碼
  1. FAILURE: Build failed with an exception.  
  2.   
  3. * What went wrong:  
  4. A problem occurred configuring project ':app'.  
  5. > Cannot evaluate module PullToRefresh : Configuration with name 'default' not found.  
  6.   
  7. * Try:  
  8. Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.  
  9.   
  10. BUILD FAILED  

 

 此時能夠發現 Cannot evaluate module PullToRefresh 有多是出錯的根源,接來下的驗證就比較簡單了,查看工程目錄下有沒有把這個module添加進去之類的。 gradle

 

2. ui

 

Console代碼   收藏代碼
  1. Error:(?, 0) Gradle DSL method not found: 'compile()'  

查看你的application(整個工程)的build.gradle,裏面 dependencies 不要包含  lua

Gradle代碼   收藏代碼
  1. classpath 'com.android.tools.build:gradle:1.3.0'  

 以外的依賴 spa

 

3. debug

Android Studio混淆編譯時,Generate Signed APK遇到 ci

Console代碼   收藏代碼
  1. Execution failed for task ':app:packageRelease'  
  2. Unable to compute hash of XXX\classes.jar  

 返回到cmd裏面執行 get

Cmd代碼   收藏代碼
  1. gradle packageRelease --stacktrace  

 獲取到核心err信息

Console代碼   收藏代碼
  1. java.io.IOException: The same input jar XXX is specified twice  

 解決方法

把proguard-rules.pro中本身定義的 -libraryjars 都註釋掉

相關文章
相關標籤/搜索