1

I am new to android development. I have created login activity and trying to add background image. Image showing properly in studio preview window, but i am getting error while running the app. Here find attached image for error message, please help [![enter image description here][1]][1]

Following error showing

Error:Execution failed for task ':app:mergeDebugResources'. Crunching Cruncher loginbg.png failed, see logs

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:background="@drawable/loginbg"
tools:context="com.example.solid.registration.LoginActivity">

<EditText
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:inputType="textEmailAddress"
    android:ems="10"
    android:id="@+id/emailLogin"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_marginLeft="38dp"
    android:layout_marginStart="38dp"
    android:layout_marginTop="156dp"
    android:hint="Email" />

<EditText
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:inputType="textPassword"
    android:ems="10"
    android:id="@+id/passwordLogin"
    android:layout_centerVertical="true"
    android:layout_alignLeft="@+id/emailLogin"
    android:layout_alignStart="@+id/emailLogin"
    android:hint="Password" />

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Login"
    android:id="@+id/buttonLogin"
    android:layout_below="@+id/passwordLogin"
    android:layout_alignLeft="@+id/passwordLogin"
    android:layout_alignStart="@+id/passwordLogin" />

here is my xml code

here is my logcat

3:37:11 AM Gradle sync started

3:38:06 AM Gradle sync completed

3:38:09 AM Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources]

3:38:18 AM Gradle build finished with 1 error(s) in 10s 885ms

3:38:30 AM Executing tasks: [:app:assembleDebug]

3:38:34 AM Gradle build finished with 1 error(s) in 4s 114ms

  • 1
    post your code and logcat – Quick learner Sep 29 '15 at 10:56
  • 3
    @quicklearner did you at least read the question ... it is compile time error ... there is no logcat logs .... pravin, first check if you don't have this image opened in some editor which makes it readonly ... ([of course you did try turn it off and on again?](https://www.youtube.com/watch?v=nn2FB1P_Mn8)) – Selvin Sep 29 '15 at 10:58
  • http://stackoverflow.com/questions/17121033/android-studio-mergedebugresources-exception – Ravi Gadipudi Sep 29 '15 at 11:01
  • This looks like a similar error to in this question http://stackoverflow.com/questions/29026024/errorexecution-failed-for-task-projectnamemergedebugresources-crunching – Richard Strand Sep 29 '15 at 11:03
  • The "+" between "@" and "id" is useful only in android:id because it say "add this id to the resources". In other case use only the reference removing the + for example: `android:layout_alignLeft="@id/passwordLogin"` – Dario Picco Sep 29 '15 at 11:17

2 Answers2

0

i had a similar problem , its for low heap memory on some phones. try reducing the image resolution then recompile it. reduce resolution to something like 200*100 or similar. did help me , hope help you too.

Pirisok
  • 401
  • 3
  • 9
0

you have to update to the latest Gradle version then close Android Studio and then open it again. Hope this will work.

prat
  • 597
  • 8
  • 17