java Android Studio 错误:org.gradle.process.internal.ExecException
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28821614/
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
Android Studio Error: org.gradle.process.internal.ExecException
提问by ctapp1
I am new to android development and have hit my first error and can't seem to get around it. I have downloaded and installed android studio and java on my mac and a made a dummy app just to see it run in the simulator. The default hello world app runs fine but as soon as I add a .png file to my drawable folder, I get this error:
我是 android 开发的新手,遇到了我的第一个错误,似乎无法解决它。我已经在我的 mac 上下载并安装了 android studio 和 java,并制作了一个虚拟应用程序只是为了看到它在模拟器中运行。默认的 hello world 应用程序运行良好,但是一旦我将 .png 文件添加到我的可绘制文件夹中,我就会收到此错误:
Error:Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/billy/Library/Android/sdk/build-tools/21.1.2/aapt'' finished with non-zero exit value 42
I few things to mention are that I only see one drawable folder, not the normal drawable-hdpi,mdpi, etc that I see in many tutorials.
我要提的几件事是,我只看到一个 drawable 文件夹,而不是我在许多教程中看到的普通 drawable-hdpi、mdpi 等。
Appreciate the help.
感谢帮助。
采纳答案by ctapp1
Well I figured out the problem..
嗯,我想出了问题..
Once I changed the .png back to a its original .jpeg extension my app ran fine. I guess AS is picky when changing the extension to the image files. Odd though when I changed it to .png and then viewed its info, it said it was indeed a portable network graphic so that is why I was confused. If someone could shed some light on what is going on here that would be great. I think the image file was a .jpeg all along that is why it was giving me "Not a PNG".
一旦我将 .png 改回其原始的 .jpeg 扩展名,我的应用程序就运行良好。我猜 AS 在更改图像文件的扩展名时很挑剔。奇怪的是,当我将其更改为 .png 然后查看其信息时,它说它确实是一个便携式网络图形,所以这就是我感到困惑的原因。如果有人能对这里发生的事情有所了解,那就太好了。我认为图像文件一直是 .jpeg 这就是为什么它给我“不是 PNG”。
Cheers
干杯
回答by Rhys Davis
This can happen when gradle fails to process resources. In your case it happened to be an invalid image file in the drawable folder, in my case it was an error in one of my XML layouts that Android Studio didn't pick up on
当 gradle 无法处理资源时,就会发生这种情况。在您的情况下,它碰巧是 drawable 文件夹中的无效图像文件,在我的情况下,这是我的一个 XML 布局中的错误,Android Studio 没有发现
回答by naveen dahiya
In linux systems, there may be issue with 32 bit lib files in 64 bit systems, I also got the same problem and is solved by installing these libs by following command -
在 linux 系统中,64 位系统中的 32 位 lib 文件可能存在问题,我也遇到了同样的问题,并通过以下命令安装这些 lib 来解决 -
yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686