Sweetalert2: gzip'ed js file in dist/ breaks AAPT

Created on 11 Nov 2016  路  1Comment  路  Source: sweetalert2/sweetalert2

Affected:

Vanilla Android and everything that uses android's tools under the hood (like Apache Cordova, Adobe Phonegap, etc.).

Problem:

The .js.gz file you're shipping in dist/ causes some problems when working with android apps.

Here's why:
When gradle tries to execute the :mergeAssets task AAPT is run.
Because .apk files are effectively special .zip files, AAPT searches for files that are already compressed to avoid re-packing.

Relevant code sample:
XREF: /frameworks/base/tools/aapt/Package.cpp

if (strcasecmp(storageName.getPathExtension().string(), ".gz") == 0) {
    fromGzip = true;
    storageName = storageName.getBasePath();
}

and

if (fromGzip) {
    result = zip->addGzip(file->getSourceFile().string(), storageName.string(), &entry);
}

TL;DR: AAPT generates a name clash when trying to rename sweetalert2.min.js.gz to sweetalert2.min.js.

Possible solution:

Remove the gzip'ed version.
It's a very rare occasion that someone gzip's his files in advance.
Most people just use tools like mod_deflate to let the server handle compression on-the-fly.

Priority

Kinda low.
You can add a simple find [folder] | grep -e '\.gz$' | xargs rm to your buildscript but newcomers might get confused while wrangling through Java's endlessly long stacktraces.

If you aren't going to remove the file we should at least document this issue in the wiki.

Most helpful comment

This is the best explained bug-report this package ever received :)

Fixed in v6.1.0

Thanks a lot, @sn0w!

>All comments

This is the best explained bug-report this package ever received :)

Fixed in v6.1.0

Thanks a lot, @sn0w!

Was this page helpful?
0 / 5 - 0 ratings