developer dev
developer dev

Reputation: 39

Getting error when I try to put background in my android program

I try to put any background in my android program like this:

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

and I got this error:

AAPT err(Facade for 972607565): D:\MyAndroid_Prog\MyAndroidProgram\OpenReg\app\src\main\res\drawable\savea.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited AAPT err(Facade for 1945943478): libpng error: Not a PNG file
Error:Execution failed for task ':app:mergeDebugResources'. Some file crunching failed, see logs for details

I tried everything but still same error when I run my program.

Is there anyone can help?

This my gradle

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"
    }

Upvotes: 0

Views: 363

Answers (1)

Sebastian Breit
Sebastian Breit

Reputation: 6159

You need to update build-tools to fix a faulty aapt.

Open sdk manager and install build-tools 23.0.1 and change your build.gradle so that it looks like this:

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

Upvotes: 0

Related Questions