简体   繁体   中英

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

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

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

rm -rf node_modules
yarn install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM