简体   繁体   中英

Gradle build doesn't work due to drawables files - Android Studio

I'm trying to build a little Android app on Android Studio. There is no error showed in my code.

When I try to deploy the app, Gradle crashes and Android Studio (version 1.5) opens me a .png file. Here is my Manifest :

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

And here comes the build error :

/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

This happens when the build tools version is not aligned with the support library. Make sure you are using the same version of build tools as the support libraries you've added under your dependencies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM