Android Studio Gradle Configuration Errors总结

来源:互联网 发布:网络新媒体有哪些 编辑:程序博客网 时间:2024/05/20 20:48

http://xuanzhui.iteye.com/blog/2245204

Android Studio Gradle Configuration Errors总结

    博客分类: 
  • Android
gradle 

1.

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

 这样的错误乍看无从下手,但是gradle提供了一个命令可以进一步地定位具体的错误

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

 此时将获取到进一步的错误信息,比如我的

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添加进去之类的。

 

2.

 

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

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

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

 之外的依赖

 

3.

Android Studio混淆编译时,Generate Signed APK遇到

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

 返回到cmd里面执行

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

 获取到核心err信息

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

 解决方法

把proguard-rules.pro中自己定义的 -libraryjars 都注释掉

0 0
原创粉丝点击