当我尝试在我的android程序中添加背景时出错

时间:2016-01-28 18:39:46

标签: android xml android-studio gradle

我尝试在我的android程序中添加任何背景:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/mypic"
    tools:context="com.mm.openreg.MainActivity">

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:id="@+id/S1"
        android:layout_height="60dp"
        android:layout_alignParentTop="true"
        android:layout_marginTop="15dp"

        android:layout_centerHorizontal="true">

我收到了这个错误:

  

AAPT错误(Facade for 972607565):D:\ MyAndroid_Prog \ MyAndroidProgram \ OpenReg \ app \ src \ main \ res \ drawable \ savea.png:libpng警告:iCCP:无法识别已编辑的已知sRGB配置文件       AAPT错误(Facade for 1945943478):libpng错误:不是PNG文件
      错误:任务&#39;:app:mergeDebugResources&#39;执行失败。   某些文件运算失败,请参阅日志以获取详细信息

当我运行程序时,我尝试了所有但仍然出现相同的错误。

有人可以提供帮助吗?

  • 我也尝试png文件和小文件 - 但同样

这是我的傻瓜

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.mm.openreg"
        minSdkVersion 18
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

1 个答案:

答案 0 :(得分:0)

您需要更新构建工具以修复错误的aapt。

打开sdk管理器并安装build-tools 23.0.1并更改build.gradle,使其如下所示:

apply plugin: 'com.android.application'
    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.1"