Execution failed for task ':app:packageRelease'. value (90354) > 0x0000ffff

0

When building a Cordova Android app, I get the following error. The error occurs when running cordova build android, and cordova build android --release, and cordova run android.

> Task :app:packageRelease
> Task :app:packageRelease FAILED
42 actionable tasks: 42 executed

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:packageRelease'.
> value (90354) > 0x0000ffff

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 16m 23s
android
cordova
asked on Stack Overflow Oct 6, 2019 by Skylar Ittner

1 Answer

0

The problem is caused by the ZIP archive format having a limit of 65535 files. An APK file is actually a renamed ZIP file, so the same limit applies.

The error message value (90354) > 0x0000ffff indicates that the APK has 90,354 files, which is more than 0x0000ffff (or 65,535 in hexadecimal).

In this case, I had a large node_modules folder inside www. I added a Cordova build hook <hook src="scripts/remove_bloat.sh" type="before_prepare" /> to config.xml, which contains the following:

#!/bin/sh
cd www/node_modules
rm -rf <unneccessary stuff>

Reducing the number of files under 65k fixed the build.

answered on Stack Overflow Oct 6, 2019 by Skylar Ittner • edited Oct 6, 2019 by Skylar Ittner

User contributions licensed under CC BY-SA 3.0