Eric
Eric

Reputation: 17536

Build error after updating to com.android.tools.build:gradle:4.2.1

I am running into the following error while building my android project:

AAPT: <project directory>\app\build\intermediates\stable_resource_ids_file\debug\stableIds.txt: error: failed to open: The data is invalid. (13).

it started happening after updating my build.gradle file in the project's app directory from com.android.tools.build:gradle:4.1.3 to com.android.tools.build:gradle:4.2.1:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ...
    dependencies {
        ...
        classpath "com.android.tools.build:gradle:4.2.1"
        ...

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

Upvotes: 0

Views: 3766

Answers (2)

Sadegh J
Sadegh J

Reputation: 1862

I had the same problem, and i fixed that with :

rm -rf node_modules
yarn install

Upvotes: 1

Eric
Eric

Reputation: 17536

For now, I am avoiding the issue by downgrading from com.android.tools.build:gradle:4.2.1 to com.android.tools.build:gradle:4.1.3 in the build.gradle file in the project's app directory:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ...
    dependencies {
        ...
        classpath "com.android.tools.build:gradle:4.1.3"     // <--- downgrade to 4.1.3 to avoid build error!!
        ...

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

Upvotes: 1

Related Questions