Android Studio 中的 Gradle 构建失败 [英] Gradle build failed in Android Studio

查看:44
本文介绍了Android Studio 中的 Gradle 构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Ubuntu 上使用 Android Studio.我启动了 Android Studio,创建了一个新项目"并使用 Shift+F10 启动它.它抛出了以下错误:

I am using Android Studio on Ubuntu. I started Android Studio, created a "New Project" and started it with Shift+F10. It threw the following error:

/home/laptop/AndroidStudioProjects/TestIt420/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.0.0/res/drawable-mdpi-v4/abc_btn_radio_to_on_mtrl_000.png
Error:Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/laptop/Android/Sdk/build-tools/21.1.2/aapt'' finished with non-zero exit value 127
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Information:BUILD FAILED

它还向我展示了一个带有圆圈和透明背景的 PNG 文件,文件名:abc_btn_radio_to_on_mtrl_000.png

Also it showed me a PNG file with a circle an a transparent background with file name: abc_btn_radio_to_on_mtrl_000.png

在我再次尝试运行该应用程序后,我现在有 2 个错误而不是一个错误:

After I just tried running the app again I now have 2 errors instead of one:

/home/laptop/AndroidStudioProjects/TestIt420/app/build/intermediates/explo     ded-aar/com.android.support/appcompat-v7/22.0.0/res/drawable-hdpi-     v4/abc_ic_ab_back_mtrl_am_alpha.png
 Error:Error: com.android.ide.common.process.ProcessException:      org.gradle.process.internal.ExecException: Process 'command      '/home/laptop/Android/Sdk/build-tools/21.1.2/aapt'' finished with non-zero      exit value 127
Error:Execution failed for task ':app:mergeDebugResources'.
>     /home/laptop/AndroidStudioProjects/TestIt420/app/build/intermediates/explo    ded-aar/com.android.support/appcompat-v7/22.0.0/res/drawable-hdpi-    v4/abc_ic_ab_back_mtrl_am_alpha.png: Error:     com.android.ide.common.process.ProcessException:     org.gradle.process.internal.ExecException: Process 'command     '/home/laptop/Android/Sdk/build-tools/21.1.2/aapt'' finished with non-zero     exit value 127
Information:BUILD FAILED

你能帮我解决这个问题吗?

Can you maybe help me in resolving the issue?

推荐答案

Android 尚未为 ubuntu 64 位构建 SDK,根据您的错误,我可以说您正在 64 位操作系统上使用 32 位 SDK.

Android has not build SDK for ubuntu 64-bit yet, and from your error I can say you are using 32-bit SDK on 64-bit OS.

您需要安装 32 位库才能在 ubuntu 中运行 android SDK.

You need to install 32-bit libraries to run android SDK in ubuntu.

启动终端并安装以下软件包.

Start terminal and install following packages.

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386

右键单击 .../AndroidSDK/sdk/build-tools/21.1.2/aapt 文件,打开它的 Properties 并确保您有 checked 权限选项卡中允许将文件作为程序执行.

Right click on the .../AndroidSDK/sdk/build-tools/21.1.2/aapt file, open it's Properties and make sure you have checked Allow executing file as a program in the Permissions tab.

这篇关于Android Studio 中的 Gradle 构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆