0

I put a background image in drawable folder and use it in background activity.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_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"
tools:context=".MainActivity$PlaceholderFragment"
android:background="@drawable/background"
>

Every time I run the project, I get the following error:

C:\ASP\InstaFollowerPlus\app\src\main\res\layout\fragment_main.xml Error:(21, 29) No resource found that matches the given name (at 'background' with value '@drawable/background'). Error:Execution failed for task ':app:processDebugResources'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\Software\Computer engineer software\Android SDK full\sdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1.

i tried Clean Project and failed.

compileSdkVersion 23, buildToolsVersion '22.0.1', Android Studio: 1.2.1.1

enter image description here

Cena Av
  • 99
  • 1
  • 10

3 Answers3

3

No resource found that matches the given name (at 'background' with value '@drawable/background').

  1. Please add images in your respective drawable folder first
  2. use compileSdkVersion 23, buildToolsVersion '23.0.1',

  3. Post your build.gradle please . Remove unwanted (Duplicate) File

  4. use Android Studio: 1.3 (Stable Version)

  5. Then Clean and build project And Sync Project

  6. Check your images are properly .PNG formatted or not

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
  • 1
    apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion '23.0.1' defaultConfig { applicationId "cad.ir.instafollowerplus" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:23.1.0' } – Cena Av Nov 04 '15 at 05:51
  • @CenaAv Please post this in your question section – IntelliJ Amiya Nov 04 '15 at 05:53
  • @CenaAv Okay .No problem .Please upgrade your repository – IntelliJ Amiya Nov 04 '15 at 05:55
  • http://stackoverflow.com/questions/29249986/finished-with-non-zero-exit-value/31180013#31180013 – IntelliJ Amiya Nov 04 '15 at 06:24
  • 1
    I just changed .png to.jpg and works! do you have any idea how this works? – Cena Av Nov 04 '15 at 10:47
  • @CenaAv At first ,Glad to hear that your problem solved .For your question , I guess your Images are not proper PNG formatted – IntelliJ Amiya Nov 04 '15 at 10:51
  • @CenaAv I would expect `PNG` to scale slightly better . – IntelliJ Amiya Nov 04 '15 at 10:54
  • @CenaAv Cheers ! Move ahead . – IntelliJ Amiya Nov 04 '15 at 11:03
0

Rename the Image via right clicking on it and selecting the Refactor>Rename. And then run it it might run.

Pravinsingh Waghela
  • 2,516
  • 4
  • 32
  • 50
0

If you use android:id="@+id/imageViewLogoTangan" to define imageID, then use the same (@+id/imageViewLogoTangan) in your another code

Saurabh Bhandari
  • 2,438
  • 4
  • 26
  • 33
Umar
  • 1