简体   繁体   English

由于可绘制文件,Gradle构建无法正常工作-Android Studio

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

I'm trying to build a little Android app on Android Studio. 我正在尝试在Android Studio上构建一个小的Android应用程序。 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. 当我尝试部署应用程序时,Gradle崩溃了,Android Studio(1.5版)为我打开了一个.png文件。 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 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. 确保使用与在依赖项下添加的支持库相同版本的构建工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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