摇篮构建失败在Android的工作室摇篮、工作室、Android

2023-09-05 11:17:30 作者:坐在坟前调戏鬼

我使用的是Android工作室在Ubuntu上。我开始Android的工作室,创造了一个新项目,并与 SHIFT + F10 启动它。它扔了以下错误:

/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 错误:错误:com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:处理'命令'/home/laptop/Android/Sdk/build-tools/21.1.2/aapt''非零退出值127完成 :应用程序:mergeDebugResources失败 失败:建立失败,一个例外。 与--stacktrace选项获取堆栈跟踪运行。与--info或--debug选项运行,以获得更多的日志输出。 信息:构建失败

此外,它向我展示了一个圆形的透明背景与文件名的PNG文件: abc_btn_radio_to_on_mtrl_000.png

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

  /家用/笔记本电脑/ AndroidStudioProjects / TestIt420 /应用程序/编译/中间体/ EXPLO DED-AAR / com.android.support / appcompat-V7 / 22.0.0 / RES / drawable- hdpi- V4 / abc_ic_ab_back_mtrl_am_alpha.png
 错误:错误:com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:处理'命令'/home/laptop/Android/Sdk/build-tools/21.1.2/aapt''非零退出值127完成
错误:执行失败的任务:应用程序:mergeDebugResources。
> /主页/笔记本电脑/ AndroidStudioProjects / TestIt420 /应用程序/编译/中间体/ EXPLO DED-AAR / com.android.support / appcompat-V7 / 22.0.0 / RES /绘制-hdpi- V4 / abc_ic_ab_back_mtrl_am_alpha.png:错误:COM。 android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:处理'命令'/home/laptop/Android/Sdk/build-tools/21.1.2/aapt''完成非零值127
信息:构建失败
 
财务共享建设为什么会失败 案例分析

您也许可以帮我解决这个问题?

解决方案

Android已经不建SDK为Ubuntu 64位着呢,从你的错误,我可以说你是在64位操作系统上使用32位SDK。

您需要安装32位的库可在Ubuntu运行Android SDK。

开始端并安装以下软件包。

  sudo的dpkg的--add-i386硬件架构
sudo易于得到更新
命令和apt-get安装libc6的:I386中的libncurses5:I386的libstdc ++ 6:I386
 

右键点击 ... / AndroidSDK / SDK /集结工具/ 21.1.2 / AAPT 文件,打开它的属性的和请确保您已检查 允许执行文件作为程序的在权限的标签。

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

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

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 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.

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

and

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.