Execution failed app:processDebugResources Android Studio

Viewed 461876

I'm using bitbucket so I can work with other developer but it seems that we can't get it to work flawlessly. I got this error after pulling the changes from him:

Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    E:\Program Files (x86)\Android\android-sdk\build-tools\19.0.0\aapt.exe package -f --no-crunch -I E:\Program Files (x86)\Android\android-sdk\platforms\android-19\android.jar -M E:\Documents\smart-my-job1\app\build\manifests\debug\AndroidManifest.xml -S E:\Documents\smart-my-job1\app\build\res\all\debug -A E:\Documents\smart-my-job1\app\build\assets\debug -m -J E:\Documents\smart-my-job1\app\build\source\r\debug -F E:\Documents\smart-my-job1\app\build\libs\app-debug.ap_ --debug-mode --custom-package com.smartmyjob
Error Code:
    -1073741819
38 Answers

In my case i had two declaration of

<?xml version="1.0" encoding="utf-8"?>

in my vector drawable icon

all i had to do was delete one

In my Case Problem solved with Instant Run Disable in Android Studio 3.1.2 Android Instant Raun Disable

it may help in the android studio 3.2.1 app build gradle it should be like

android {
    compileSdkVersion 27
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.sample.mvphelloworld"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
       implementation fileTree(dir: 'libs', include: ['*.jar'])
       compile 'com.android.support:appcompat-v7:27.1.1'
       implementation 'com.android.support.constraint:constraint-layout:1.1.3'
       testImplementation 'junit:junit:4.12'
       androidTestImplementation 'com.android.support.test:runner:1.0.2'
       androidTestImplementation 'com.android.support.test.espresso:espresso- 
       core:3.0.2'
}

Gradle to 4.6
plugin version to 3.2.1

I have removed all folder inside \app\build\ folder and run again it works for me.

E:\AndroidData\mobile-app\AwesomeProject\android\app\build

In my case several red lines appeared like:

AGPBI: {"kind":"error","text":"error: resource drawable/start_gray_border (aka com.example:drawable/start_gray_border) not found.","sources":[{"file":"C:\\Users\\User\\AndroidStudioProjects\\example\\app\\src\\main\\res\\layout\\activity_start.xml","position":{"startLine":37}}],"original":"","tool":"AAPT"}

I tried gradlew build --stacktrace, rebuild, clean build, checked file names, checked if resources contained invisible symbols, LF, CRLF, changed libraries versions and so on. A problem was in new XML files:

<?xml version="1.0" encoding="utf-8"?><?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
...

Removed a duplicate tag. I understood where a problem is when reverting to previous commit in GIT. After that added several new files and saw what file raises error.

In my case, I changed the android section in build.gradle and the problem faded away:

android {
compileSdkVersion 28

lintOptions {
    disable 'InvalidPackage'
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "app.ozel"
    minSdkVersion 16
    targetSdkVersion 28
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.debug
    }
}

}

In my case, I needed to turn off Avast antivirus for a build time. Antivirus was blocking build when it tried to process this file:

platforms\android\app\build\intermediates\runtime_symbol_list\debug\R.txt

This error has a chance of triggering when the API version AVD which you selected is not the same as you specified in Project_folder>android>app>build.gradle as compileSdkVersion and targetSdkVersion.

Earlier my API version was 27 and now it is 30. I have changed the values of the above two parameters to 30 and my problem got solved.

The problem in my case was in my activity.xml . I had forgotten to add the reference in the beginning of the xml file. For example, I had this code

   <com.huawei.hms.ads.banner.BannerView
            android:id="@+id/hw_banner_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:visibility="visible"
            hwads:adId="testw6vs28auh3" ------------------> THIS NEEDED REFERENCE
            hwads:bannerSize="BANNER_SIZE_360_57"/>

I fixed by adding this

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:hwads="http://schemas.android.com/apk/res-auto" --------> ADD THIS

for me it was a missing Manifest that was to blame. I created a new module and forgot to add Manifest

Related