execution failed for task,Error:Execution failed for task ':clean'.
execution failed for task,Error:Execution failed for task ':clean'.详细介绍
本文目录一览: execution failed for task 怎么办
1.报这样的错误,通常是module代码异常,编译不通过,解决办法:检查代码提示错误的地方,点击“Build——>Make module‘app’重新编译”不报错,即可成功运行
在引用第三方库时出现出现Error:Execution failed for task ':app:processDebugManifest'
Error:Execution failed for task ':app:processBaiduDebugManifest'.> Manifest merger failed : Attribute application@name value= “” from AndroidManifest.xml:57:9-28 is also present at AndroidManifest.xml:3:16-53 value=(com.mob.MobApplication). Suggestion: add 'tools:replace="android:name"' to element at AndroidManifest.xml:56:5-604:19 to override.
原因是我们的主项目中默认会定义了 `android:icon=""` ,当我们引入的第三方库中也定义
了这种标签的时候,二者合并失败就会出现此问题。
?解决办法是在 标签中 添加 tools:replace="android:icon" .
首先要在 标签中增加一个 tools 的命名空间 :
? ? ?xmlns:tools="http://schemas.android.com/tools"
如果需要添加多个就在二者都合并失败时,中间应该用","隔开 :
如何解决error:execution failed for task app:transformclasseswithjarmerging
在开发的时候,经常遇到
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/graphics/ColorUtils.cla
这类问题,网上都说是JAR包冲突,但解决的方法都说是删除重复的JAR包,但有些情况下却不能删除,因此在此记录一下自己遇到这类问题时的解决办法。
1 clear一下,看看能不能解决,经常遇到调试了半天,最后clear就自动好了的情况,我也不知道啥情况,感觉是缓存问题,但又觉得不太像;
2 若引用了相同的jar,删除一个吧,特别是在module很多的时候,里面经常引用相同的JAR,或者jar跟下载地址都是同一个,只用一个吧,好歹让代码别那么繁琐。
3 两个不同的JAR,里面引用了相同的其他jar,这样的问题最麻烦,没法删除,除非重新生成JAR;不过,可以在依赖里面排除相同的包,例如
fresco的依赖:
compile(
'com.facebook.fresco:fresco:0.14.1'
) {
exclude module:
'support-v4'
exclude group:
'com.android.support'
大括号里面写你要排除的东西
这种问题一般这样都能搞定,还没遇到其他状况
1.dexDebug ExecException finished with non-zero exit value 2
需要在gradle中配置下面的代码,原因是引用了多个libraries文件
defaultConfig {
multiDexEnabled true
}
2.Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/app/BackStackState$1.class
原因:在所添加的jar包或aar包中也引用了support-V4,与工程中引用的相冲突
Ctrl+N --> 在搜索框中输入BackStackState --> 查找到所有引用该类的类,这些类即为引起冲突的类
去掉本工程中gradle中用于引用有冲突的包的代码或者将冲突的代码从jar包或aar包中移除,确保一个module中只引用了一份相同的第三方包
3.project sturcture和Project Structure 无论是按快捷键或者是从files中打开都不显示
event log中报:IllegalArgumentException:Multiple entries with same key: Google Inc.:Google APIs:23=Google APIs (Google Inc.) (API 23) and Google Inc.:Google APIs:23=Google APIs (Google Inc.) (API 23)
解决办法:先看一下系统配置的SDK的位置和Android Studio所用的路径是否一致,如果不一致重新配置系统的SDK路径或者是重新修改Android Studio的SDK路径
通过SDK Manager删除掉google API23
如果解决不了,卸载android studio -->重新安装 ,还有问题点击File --> Invalidate Cashes/Restart --> Invalidate and Restart,解决不了继续通过SDK Manager删除掉google API23
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'
在引入聊天包时运行包一下错误:
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [
\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [\app\build\intermediates\transforms\desugar\debug\45.jar(;;;;;;**.class)] (Duplicate zip entry [45.jar:io/github/rockerhieu/emojicon/emoji/Emojicon$1.class]))
研究发现是JDK 1.8 版本问题、这并不像是偶然现象,于是怀疑 Gradle 与 JDK 1.8 存在兼容性问题、尝试将工程依赖的 JDK 版本降到 1.7,运行成功。
android studio出现Error:Execution failed for task ':app:processDebugResources'. ) 的问题
Android Studio导入eclipse项目编译出错。
信息如下:
AAPT: libpng error: Not a PNG file
Execution failed for task ':app:mergeDebugResources'.
> Some file crunching failed, see logs for details
如何学好英语:
1、牢记词汇。
2、掌握语法。
3、磨耳朵。
4、背诵范文。
5、勇敢说出来。
打开命令窗口 cd 到当前项目路径
window 运行 gradlew assembleDebug --info
linux 运行 ./gradlew assembleDebug --info
查看error,一般就知道缺少哪个素材了
这种问题,大多数都是由于必要的运行文件没有下载,你需要设置网络代理才能进行下载,就是设置一个可以下载谷歌资源的镜像。
Error:Execution failed for task ':clean'.
第一种方法:
build文件夹,可以使用360文件粉碎机删除,
然后重启Android Studio即可!
转自
第二种方法:
进入studio,进入settings,搜索instant run,进入该界面,有四个选项,第一个默认是打勾的,去其去掉就可以了。需要重启
Android开发中遇到的编译问题-Execution failed for task ':app:checkDebugDuplicateClasses'.
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
? > Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.3.1-runtime (androidx.core:core:1.3.1) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
? ? Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules core-1.3.1-runtime (androidx.core:core:1.3.1) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
? ? Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules core-1.3.1-runtime (androidx.core:core:1.3.1) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
? ? Duplicate class android.support.v4.os.IResultReceiver found in modules core-1.3.1-runtime (androidx.core:core:1.3.1) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
? ? Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules core-1.3.1-runtime (androidx.core:core:1.3.1) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
? ? Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules core-1.3.1-runtime (androidx.core:core:1.3.1) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
? ? Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.3.1-runtime (androidx.core:core:1.3.1) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
? ? Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.3.1-runtime (androidx.core:core:1.3.1) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
? ? Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.3.1-runtime (androidx.core:core:1.3.1) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
? ? Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.3.1-runtime (androidx.core:core:1.3.1) and support-compat-24.2.0-runtime (com.android.support:support-compat:24.2.0)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
gradle.properties配置文件中,添加以下配置
# 表示使用AndroidX相关依赖
android.useAndroidX=true
# 表示将第三方库迁移到androidx
android.enableJetifier=true
Error:Execution failed for task ':library:compileReleaseJavaWithJavac'. )
修改为: dependencies {
classpath ';org.robolectric:robolectric-gradle-plugin:0.11.+';
}
同时把apply plugin: 'android-test' 修改为apply plugin: 'robolectric'
再运行Gradle clean build,即可。
IDE用的是AS3.0,工程一直编译的好好的,后来不知道改动了什么,编译没问题,运行的时候就报Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
查了下也没发找到答案,什么删除.gradle重新clean没用,删除.idea和其它配置,重新导入工具再编译一样没用,最后看到一篇文章,说是.jar包重复,说是去掉就可以了。其实我工程里面是没有重复引用的jar库,但是居然真的是解决了。打开工程的依赖项,删除里面的项appcompat-v7包就行了
Error:Execution failed for task ':app:generateDebugBuildConfig'. ) java.io.F
我也遇到过这种错误,一般都是android studio本身的问题,是由于项目缺少jar包,或者程序存在错误。你打开error查看一下错误日志,贴出来