Gradle构建由于drawables文件而无法工作 - Android Studio

时间:2016-01-18 18:32:31

标签: android android-studio gradle

我试图在Android Studio上构建一个小型Android应用。 我的代码中没有显示错误。

当我尝试部署应用程序时,Gradle崩溃,Android Studio(版本1.5)打开了一个.png文件。 这是我的清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.saphirel.toto">

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>

Styles.xml

<resources>
  <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"></style>
</resources>

这就是构建错误:

/home/UserName/AndroidStudioProjects/Toto/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.3/res/drawable-mdpi/abc_btn_switch_to_on_mtrl_00012.9.png

Error:Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/UserName/android-sdk-linux/build-tools/19.1.0/aapt'' finished with non-zero exit value 127

:app:mergeDebugResources FAILED

Error:Execution failed for task ':app:mergeDebugResources'.

/UserName/AndroidStudioProjects/Toto/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.3/res/drawable-mdpi/abc_btn_switch_to_on_mtrl_00012.9.png: 

Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/saphirel/android-sdk-linux/build-tools/19.1.0/aapt'' finished with non-zero exit value 127

1 个答案:

答案 0 :(得分:0)

当构建工具版本未与支持库对齐时,会发生这种情况。确保您使用的是与您在依赖项下添加的支持库相同版本的构建工具。