AndroidStudio十佳常见编译或运行错误集锦

Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\sdk\build-tools\19.1.0\aapt.exe'' finished with non-zero exit value 1
buildToolsVersion改大一点。看最后一个aapt.exe可以知道是构建工具版本问题。然后有时候android studio发神经,只需要clear一下工程就可以搞定


Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Multi dex requires Build Tools 21.0.0 / Current: 20
buildToolsVersion改大一点。sync的时候不会报错,运行时候会比较手机系统版本和构建根据版本。构建工具版本太低,达不到手机版本号,欠缺某些函数,会发生函数转换错误。


Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'.

targetSdkVersion不能小于依赖的appcompat-v7版本。因为v7是向上兼容的。对目标机型的系统版本提供支持,它的存在才有意义。

另外如果我们在很高比如level=21的tagversion上的话,对应的v7版本也要21+,这样会有很多资源找不到。所以我一般用很猥琐的办法,就是tagversion改低一点。这样v7也可以写低一点,然后就不会出现找不到什么资源文件的错误了。


Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
stackoverflow上的大神是这么说的 This is quite common when including jar files...吧啦吧啦...Though I should stress that unless you actually get problems, this isn't something to worry about.。所以只要能运行起来,不用管这个问题


Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:7:9-43
	is also present at [Tdwow:session:unspecified] AndroidManifest.xml:21:9-45 value=(@drawable/ic_launcher).
	Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:5:5-18:19 to override.

这个鸟问题是因为gradle在build工程的时候会去merge内部的manifest.xml里的资源。如果类似android:icon=...这种公共资源同时存在于model和app中,可能就会发生合并异常


Android Studio在创建项目是一直处于building “project name”gradle project info的解决办法

方法1、修改项目 gradle/wrapper 目录下的 gradle-wrapper.properties , 将 其中的 distributionUrl 修改成本地地址(前提是把gradle文件下载到本地)。

方法2、我的项目需要的gradle版本为gradle-1.9-all.zip下载完毕后直接把zip拷贝到C:\Users\用户名\.gradle\wrapper\dists\gradle-1.XX-all\3jdgemv0iv8uqohg3kcp2o88r1\ 下重启Android Studio后,打开项目即可


Android Studio: failed to complete gradle execution, cause :

sync项目的时候不报错,但是run的时候报错尼玛。大神说是adnroidstudio检测到内存不足。设置一下。File->Setting->Gradle->Gradle Vm Option。然后put this value -Xmx256m in the box, and hit the Apply button.



  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值