Android 任务 :':app:mergeDebugResources' 执行失败。安卓工作室
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22583418/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Execution failed for task :':app:mergeDebugResources'. Android Studio
提问by user3100088
I've just installed android studio and there's an error I don't know how to fix
我刚刚安装了 android studio,但出现了一个错误,我不知道如何解决
回答by John
I can see libc error in the log.
我可以在日志中看到 libc 错误。
install these packages in your system
在您的系统中安装这些软件包
sudo apt-get install lib32stdc++6 lib32z1 lib32z1-dev
Restart android studio after installation
安装后重启android studio
回答by ashumeow
Try clean project...
尝试干净的项目...
If it doesn't work... Then... Goto build.gradle in project section
如果它不起作用......那么......在项目部分转到build.gradle
Try downgrading the gradle version
尝试降级gradle版本
From...
从...
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
To...
到...
dependencies {
classpath 'com.android.tools.build:gradle:1.2.0'
}
Then gradle.properties, add this
然后gradle.properties,添加这个
org.gradle.jvmargs=-XX\:MaxHeapSize\=256m -Xmx256m
Sync it... Clean/Rebuild... It worked for me... So, I am sharing...
同步它......清理/重建......它对我有用......所以,我正在分享......
回答by Isaias Grifo
I had that problem, but it was because my images changed them manually from .JPG to .PNG, so I just changed them with PNG paint and solved the problem
我遇到了这个问题,但那是因为我的图像手动将它们从 .JPG 更改为 .PNG,所以我只是用 PNG 油漆更改它们并解决了问题
回答by Gaurav Saluja
This issue can be resolved by trying multiple solutions like:
可以通过尝试多种解决方案来解决此问题,例如:
- Clean the project OR delete build folder and rebuild.
- Downgrading gradle version
- Check for the generated build file path, as it may be exceeding the windows max path length of 255 characters. Try using short names to make sure your project path is not too long.
- You may have a corrupted .9.png in your drawables directory
- 清理项目或删除构建文件夹并重建。
- 降级gradle版本
- 检查生成的构建文件路径,因为它可能超过 255 个字符的 Windows 最大路径长度。尝试使用短名称以确保您的项目路径不会太长。
- 您的 drawables 目录中可能有损坏的 .9.png
回答by Saravana Kumar
In My case, I've written below code in build.gradle
就我而言,我在build.gradle 中编写了以下代码
android {
// ...
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
// ...
}
It's work for me!...
这对我有用!...
回答by Aravinda Weerasekara
How to fix app:mergeDebugResources in Android Studio (Resource path could not resolved / R.id is not accessible)
如何修复 Android Studio 中的 app:mergeDebugResources(资源路径无法解析/R.id 不可访问)
- Go to the project folder from file explorer.
- Delete(before delete Backup all files) .idea folder
- If there are any .gradle folder do the 2nd step to the .gradle folder too.
- If the Exception is referring any 3rd party library/jar file delete that also(keep a backup to add later)
- Open the project again from Android studio as "Open an existing android studio project"
- On right side gradle tab click "Refresh all Gradle projects".This will create the gradel project dependancies
- Now add again 3rd party libraries to the same previous folder structure
- 从文件资源管理器转到项目文件夹。
- 删除(删除前备份所有文件).idea文件夹
- 如果有任何 .gradle 文件夹,也对 .gradle 文件夹执行第二步。
- 如果异常是指任何 3rd 方库/jar 文件也删除(保留备份以备后用)
- 从 Android Studio 再次打开项目为“打开现有的 android studio 项目”
- 在右侧 gradle 选项卡上单击“刷新所有 Gradle 项目”。这将创建 Gradel 项目依赖项
- 现在再次将第 3 方库添加到相同的先前文件夹结构中
This should resolve your Gradle issue.. good luck.
这应该可以解决您的 Gradle 问题......祝你好运。
回答by captain kabir
回答by giving_the_world
Okay here is a simple fix.
好的,这是一个简单的修复。
This error popped in front of me when I tried to manually change .jpg file to .png and then was copying & pasting it in my 'drawable' folder.
当我尝试手动将 .jpg 文件更改为 .png 然后将其复制并粘贴到我的“ drawable”文件夹中时,这个错误突然出现在我面前。
I rebuild and cleaned Project many times but nothing happened, then I removed that .png image and replaced that file with a different pre-existing .png image (or you can change it by help of paint and then paste it in drawable folder)
我多次重建和清理项目,但什么也没发生,然后我删除了那个 .png 图像并用不同的预先存在的 .png 图像替换了该文件(或者您可以通过绘画帮助更改它,然后将其粘贴到可绘制文件夹中)
Now rebuild and clean the project . It works.
现在重建并清理项目。它有效。
Hope it helps..!
希望能帮助到你..!
回答by MSD
If you have recently used ionic cordova resources or ionic resources command please check the files generated in folders of platform/build/res there might be some files corrupted , so just delete those files and build the apk.. hope it helps someone worked for me
如果您最近使用过 ionic cordova resources 或 ionic resources 命令,请检查在 platform/build/res 文件夹中生成的文件,可能有一些文件已损坏,因此只需删除这些文件并构建 apk .. 希望它可以帮助为我工作的人
回答by Nikos Hidalgo
For me upgrading gradle version and plugin to the latest version did the trick.
对我来说,将 gradle 版本和插件升级到最新版本就成功了。