capacitor icon indicating copy to clipboard operation
capacitor copied to clipboard

bug: Assets with .gz extension removed on android

Open Nicodemos234 opened this issue 1 year ago • 1 comments

Bug Report

Capacitor Version

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 4.0.1
  @capacitor/core: 4.0.1
  @capacitor/android: 4.0.1
  @capacitor/ios: 4.0.1

Installed Dependencies:

  @capacitor/ios: not installed
  @capacitor/cli: 4.0.1
  @capacitor/android: 4.0.1
  @capacitor/core: 4.0.1

[success] Android looking great! 👌

Platform(s)

Android

Current Behavior

When run the app on android, files with gz extension in final result don't has the gz extension (you can extract the apk to see) ex: A file like test.gz results in test

Expected Behavior

Keep the complety file name when building for android

Code Reproduction

The code already has the gz file on dist and the builded apk with cap run android extracted (on /android/app/build/outputs/apk/debug/app-debug) and the file bugged is ./app-debug/assets/public/assets/test.tar, that was to be test.tar.xz you can rebuild running cap run android and extracting the result apk to see the problem, the test.tar.gz is test.tar. https://github.com/Nicodemos234/capacitor-gz-android-bug

Other Technical Details

npm --version output: 8.8.0

node --version output: v18.4.0

Nicodemos234 avatar Aug 08 '22 20:08 Nicodemos234

This is not caused by capacitor and is actually the behaviour of the AAPT (Android Asset Packaging Tool) where it will purposely strip off the .gz from a file. Im not to sure why they do this but it is deliberate. Here is a link to the source of the AAPT where this happens: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/tools/aapt/Package.cpp;drc=18f16d6241c6398a034237c2a5343f94d1938f6a;l=276

IT-MikeS avatar Aug 09 '22 13:08 IT-MikeS

It looks like this issue didn't get the information it needed, so I'll close it for now. If I made a mistake, sorry! I am just a bot.

Have a great day! Ionitron 💙

Ionitron avatar Aug 25 '22 00:08 Ionitron

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Nov 10 '22 18:11 ionitron-bot[bot]