Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid chunk type #2099

Closed
s1h4r opened this issue Jun 4, 2019 · 23 comments
Closed

Invalid chunk type #2099

s1h4r opened this issue Jun 4, 2019 · 23 comments
Milestone

Comments

@s1h4r
Copy link

s1h4r commented Jun 4, 2019

Information
Apktool Version (apktool -version) - v2.4.0
Operating System (Mac, Linux, Windows) - Windows and Linux
APK From? (Playstore, ROM, Other) - Google Play store
https://play.google.com/store/apps/details?id=com.bukalapak.android&hl=in

root@jeruk:/home/sihar# apktool d bukalapak.apk 
I: Using Apktool 2.4.0 on bukalapak.apk
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Invalid chunk type: expected=0x00000200, got=0x00000203
        at brut.androlib.res.decoder.ARSCDecoder.checkChunkType(ARSCDecoder.java:542)
        at brut.androlib.res.decoder.ARSCDecoder.readTablePackage(ARSCDecoder.java:88)
        at brut.androlib.res.decoder.ARSCDecoder.readTableHeader(ARSCDecoder.java:82)
        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
        at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:748)
        at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:67)
        at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:59)
        at brut.androlib.Androlib.getResTable(Androlib.java:68)
        at brut.androlib.ApkDecoder.setTargetSdkVersion(ApkDecoder.java:228)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:118)
        at brut.apktool.Main.cmdDecode(Main.java:167)
        at brut.apktool.Main.main(Main.java:76)
@iBotPeaches
Copy link
Owner

Damn this apk is weird. It has like 60+ dynamic references.

Package Group 67 id=0x5a packageCount=1 name=com.bukalapak.android.feature_train
  DynamicRefTable entryCount=67:
    0x7d -> com.bukalapak.android.feature_auth
    0x5d -> com.bukalapak.android.feature_auto_promo_campaign
    0x7c -> com.bukalapak.android.feature_automatic_review
    0x76 -> com.bukalapak.android.feature_brand_page
    0x75 -> com.bukalapak.android.feature_brand_search
    0x71 -> com.bukalapak.android.feature_bukabike
    0x7b -> com.bukalapak.android.feature_bukadonasi
    0x70 -> com.bukalapak.android.feature_bukajabar
    0x7a -> com.bukalapak.android.feature_bukamall
    0x79 -> com.bukalapak.android.feature_bukamart
    0x78 -> com.bukalapak.android.feature_bukamobil
    0x6f -> com.bukalapak.android.feature_bukanonton
    0x42 -> com.bukalapak.android.feature_bukareksa
    0x77 -> com.bukalapak.android.feature_bukareview
    0x6e -> com.bukalapak.android.feature_bukastruk
    0x5c -> com.bukalapak.android.feature_bus
    0x73 -> com.bukalapak.android.feature_cart
    0x49 -> com.bukalapak.android.feature_category
    0x72 -> com.bukalapak.android.feature_chat
    0x6d -> com.bukalapak.android.feature_checkout_marketplace
    0x57 -> com.bukalapak.android.feature_complaint
    0x4a -> com.bukalapak.android.feature_convenience_store_courier
    0x6c -> com.bukalapak.android.feature_dana
    0x3e -> com.bukalapak.android.feature_deals
    0x5e -> com.bukalapak.android.feature_discount_products
    0x6b -> com.bukalapak.android.feature_discover
    0x59 -> com.bukalapak.android.feature_event
    0x45 -> com.bukalapak.android.feature_financial_calculator
    0x50 -> com.bukalapak.android.feature_flashdeal
    0x5b -> com.bukalapak.android.feature_flight
    0x6a -> com.bukalapak.android.feature_friendship
    0x69 -> com.bukalapak.android.feature_fun_room
    0x3b -> com.bukalapak.android.feature_funding
    0x68 -> com.bukalapak.android.feature_game_voucher
    0x67 -> com.bukalapak.android.feature_garage_sale
    0x66 -> com.bukalapak.android.feature_home
    0x63 -> com.bukalapak.android.feature_inspiration
    0x62 -> com.bukalapak.android.feature_insurance
    0x44 -> com.bukalapak.android.feature_merchant_page
    0x58 -> com.bukalapak.android.feature_my_coupons
    0x74 -> com.bukalapak.android.feature_omnisearch
    0x46 -> com.bukalapak.android.feature_postpaid
    0x52 -> com.bukalapak.android.feature_premium_seller
    0x4d -> com.bukalapak.android.feature_prepaid_electricity
    0x40 -> com.bukalapak.android.feature_prepaid_phone_credit
    0x3f -> com.bukalapak.android.feature_priority_buyer
    0x61 -> com.bukalapak.android.feature_product_category
    0x60 -> com.bukalapak.android.feature_product_detail
    0x43 -> com.bukalapak.android.feature_product_discount
    0x65 -> com.bukalapak.android.feature_product_organizer
    0x41 -> com.bukalapak.android.feature_product_review
    0x54 -> com.bukalapak.android.feature_profile
    0x5f -> com.bukalapak.android.feature_promo
    0x4f -> com.bukalapak.android.feature_promoted_push
    0x4e -> com.bukalapak.android.feature_push
    0x64 -> com.bukalapak.android.feature_referral
    0x7e -> com.bukalapak.android.feature_sample
    0x47 -> com.bukalapak.android.feature_sell_product
    0x55 -> com.bukalapak.android.feature_seller_transaction
    0x53 -> com.bukalapak.android.feature_sellersubsidize
    0x4c -> com.bukalapak.android.feature_serbu_seru
    0x56 -> com.bukalapak.android.feature_smart_printer
    0x51 -> com.bukalapak.android.feature_smartcard
    0x4b -> com.bukalapak.android.feature_spin_win
    0x3c -> com.bukalapak.android.feature_syariah
    0x3d -> com.bukalapak.android.feature_topup_emoney
    0x5a -> com.bukalapak.android.feature_train

Confirmed.

@astroidnu
Copy link

any updates?

@risalfajar
Copy link

Bukalapak

Damn this apk is weird. It has like 60+ dynamic references.

Package Group 67 id=0x5a packageCount=1 name=com.bukalapak.android.feature_train
  DynamicRefTable entryCount=67:
    0x7d -> com.bukalapak.android.feature_auth
    0x5d -> com.bukalapak.android.feature_auto_promo_campaign
    0x7c -> com.bukalapak.android.feature_automatic_review
    0x76 -> com.bukalapak.android.feature_brand_page
    0x75 -> com.bukalapak.android.feature_brand_search
    0x71 -> com.bukalapak.android.feature_bukabike
    0x7b -> com.bukalapak.android.feature_bukadonasi
    0x70 -> com.bukalapak.android.feature_bukajabar
    0x7a -> com.bukalapak.android.feature_bukamall
    0x79 -> com.bukalapak.android.feature_bukamart
    0x78 -> com.bukalapak.android.feature_bukamobil
    0x6f -> com.bukalapak.android.feature_bukanonton
    0x42 -> com.bukalapak.android.feature_bukareksa
    0x77 -> com.bukalapak.android.feature_bukareview
    0x6e -> com.bukalapak.android.feature_bukastruk
    0x5c -> com.bukalapak.android.feature_bus
    0x73 -> com.bukalapak.android.feature_cart
    0x49 -> com.bukalapak.android.feature_category
    0x72 -> com.bukalapak.android.feature_chat
    0x6d -> com.bukalapak.android.feature_checkout_marketplace
    0x57 -> com.bukalapak.android.feature_complaint
    0x4a -> com.bukalapak.android.feature_convenience_store_courier
    0x6c -> com.bukalapak.android.feature_dana
    0x3e -> com.bukalapak.android.feature_deals
    0x5e -> com.bukalapak.android.feature_discount_products
    0x6b -> com.bukalapak.android.feature_discover
    0x59 -> com.bukalapak.android.feature_event
    0x45 -> com.bukalapak.android.feature_financial_calculator
    0x50 -> com.bukalapak.android.feature_flashdeal
    0x5b -> com.bukalapak.android.feature_flight
    0x6a -> com.bukalapak.android.feature_friendship
    0x69 -> com.bukalapak.android.feature_fun_room
    0x3b -> com.bukalapak.android.feature_funding
    0x68 -> com.bukalapak.android.feature_game_voucher
    0x67 -> com.bukalapak.android.feature_garage_sale
    0x66 -> com.bukalapak.android.feature_home
    0x63 -> com.bukalapak.android.feature_inspiration
    0x62 -> com.bukalapak.android.feature_insurance
    0x44 -> com.bukalapak.android.feature_merchant_page
    0x58 -> com.bukalapak.android.feature_my_coupons
    0x74 -> com.bukalapak.android.feature_omnisearch
    0x46 -> com.bukalapak.android.feature_postpaid
    0x52 -> com.bukalapak.android.feature_premium_seller
    0x4d -> com.bukalapak.android.feature_prepaid_electricity
    0x40 -> com.bukalapak.android.feature_prepaid_phone_credit
    0x3f -> com.bukalapak.android.feature_priority_buyer
    0x61 -> com.bukalapak.android.feature_product_category
    0x60 -> com.bukalapak.android.feature_product_detail
    0x43 -> com.bukalapak.android.feature_product_discount
    0x65 -> com.bukalapak.android.feature_product_organizer
    0x41 -> com.bukalapak.android.feature_product_review
    0x54 -> com.bukalapak.android.feature_profile
    0x5f -> com.bukalapak.android.feature_promo
    0x4f -> com.bukalapak.android.feature_promoted_push
    0x4e -> com.bukalapak.android.feature_push
    0x64 -> com.bukalapak.android.feature_referral
    0x7e -> com.bukalapak.android.feature_sample
    0x47 -> com.bukalapak.android.feature_sell_product
    0x55 -> com.bukalapak.android.feature_seller_transaction
    0x53 -> com.bukalapak.android.feature_sellersubsidize
    0x4c -> com.bukalapak.android.feature_serbu_seru
    0x56 -> com.bukalapak.android.feature_smart_printer
    0x51 -> com.bukalapak.android.feature_smartcard
    0x4b -> com.bukalapak.android.feature_spin_win
    0x3c -> com.bukalapak.android.feature_syariah
    0x3d -> com.bukalapak.android.feature_topup_emoney
    0x5a -> com.bukalapak.android.feature_train

Confirmed.

Bukalapak is one of the biggest E-Commerce company in Indonesia, it makes sense they have lots of dynamic feature. And maybe they have their own protection against APK Reverse Engineering?

@AndnixSH
Copy link

AndnixSH commented Dec 4, 2020

MT manager app on Android can bypass this error. Editing arsc file and save it will fix the problem for apktool.jar

Full tutorial: https://platinmods.com/threads/how-to-fix-apktool-decompile-error-using-mt-manager-app-arscdecoder-error.121708/

@psa-rhacene
Copy link

psa-rhacene commented Dec 14, 2020

Hello,

I have the same issue with my universal-apk.
I was always using apktool with normal apk and it works, but when i generate a bundle then a universal apk from this bundle, i have this same error : Exception in thread "main" brut.androlib.AndrolibException: Invalid chunk type: expected=0x00000200, got=0x00000203

I use bundletool to generate the apk, or also with android studio gradle task for universal apk "packageMyAppDebugUniversalApk"

My goal is to extract language resources strings.xml for each country

@dhee9000
Copy link

Still having this issue with APKs is there any update on this?

@attacus
Copy link

attacus commented Feb 26, 2021

Is this an issue with Android App Bundle APKs particularly? I keep running into APKs that cause apktool to throw this error more often, and App Bundle is going to be made mandatory sometime in 2021.
@iBotPeaches what kind of support do you need for this fix?

@iBotPeaches
Copy link
Owner

@iBotPeaches what kind of support do you need for this fix?

I need more knowledge how to reproduce these dynamic ref tables in a small application that I control so I can see the before (before build) and identify the parameters that aapt/aapt2 uses to produce this then I can compare to the built binary.

The chunk error is here, but I'm more concerned with the multiple packages within one resources.arsc. It seems Apktool never properly supported those. You can see with the following issue.

#2514
#2002
#1550

@iBotPeaches
Copy link
Owner

This is partially fixed so I'm closing this ticket. It now decodes without issue after the merge of #2527

However, it as shown below has multiple packages per resources.arsc which is an ongoing issue being tracked here - #2514

➜  2099 apktool d mobile-legends-bang-bang_1.5.32.5811.apk -f
I: Using Apktool 2.5.1-45c91e-SNAPSHOT on mobile-legends-bang-bang_1.5.32.5811.apk
I: Loading resource table...
I: Decoding Shared Library (com.mobile.legends.AdMobAdapter), pkgId: 119
I: Decoding Shared Library (com.mobile.legends.AdMobAdapter), pkgId: 119
I: Decoding Shared Library (com.mobile.legends.Agora), pkgId: 126
I: Decoding Shared Library (com.mobile.legends.AdMobAdapter), pkgId: 119
I: Decoding Shared Library (com.mobile.legends.CleanMaster), pkgId: 125
I: Decoding Shared Library (com.mobile.legends.Agora), pkgId: 126
I: Decoding Shared Library (com.mobile.legends.AdMobAdapter), pkgId: 119
I: Decoding Shared Library (com.mobile.legends.Danmaku), pkgId: 121
I: Decoding Shared Library (com.mobile.legends.CleanMaster), pkgId: 125
I: Decoding Shared Library (com.mobile.legends.Agora), pkgId: 126
I: Decoding Shared Library (com.mobile.legends.AdMobAdapter), pkgId: 119
I: Decoding Shared Library (com.mobile.legends.QiniuShortVideo), pkgId: 120
I: Decoding Shared Library (com.mobile.legends.Danmaku), pkgId: 121
I: Decoding Shared Library (com.mobile.legends.CleanMaster), pkgId: 125
I: Decoding Shared Library (com.mobile.legends.Agora), pkgId: 126
I: Decoding Shared Library (com.mobile.legends.AdMobAdapter), pkgId: 119
I: Decoding Shared Library (com.mobile.legends.QiniuShortVideo), pkgId: 120
I: Decoding Shared Library (com.mobile.legends.Danmaku), pkgId: 121
I: Decoding Shared Library (com.mobile.legends.Stream), pkgId: 123
I: Decoding Shared Library (com.mobile.legends.CleanMaster), pkgId: 125
I: Decoding Shared Library (com.mobile.legends.Agora), pkgId: 126
I: Decoding Shared Library (com.mobile.legends.AdMobAdapter), pkgId: 119
I: Decoding Shared Library (com.mobile.legends.QiniuShortVideo), pkgId: 120
I: Decoding Shared Library (com.mobile.legends.Danmaku), pkgId: 121
I: Decoding Shared Library (com.mobile.legends.WallPaper), pkgId: 122
I: Decoding Shared Library (com.mobile.legends.Stream), pkgId: 123
I: Decoding Shared Library (com.mobile.legends.CleanMaster), pkgId: 125
I: Decoding Shared Library (com.mobile.legends.Agora), pkgId: 126
I: Decoding Shared Library (com.mobile.legends.AdMobAdapter), pkgId: 119
I: Decoding Shared Library (com.mobile.legends.QiniuShortVideo), pkgId: 120
I: Decoding Shared Library (com.mobile.legends.Danmaku), pkgId: 121
I: Decoding Shared Library (com.mobile.legends.WallPaper), pkgId: 122
I: Decoding Shared Library (com.mobile.legends.Stream), pkgId: 123
I: Decoding Shared Library (com.mobile.legends.WifiDetective), pkgId: 124
I: Decoding Shared Library (com.mobile.legends.CleanMaster), pkgId: 125
I: Decoding Shared Library (com.mobile.legends.Agora), pkgId: 126
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/ibotpeaches/.local/share/apktool/framework/1.apk
W: Could not decode attr value, using undecoded value instead: ns=android, name=resource, value=0x77050000
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Baksmaling classes3.dex...
I: Baksmaling assets/audience_network.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I: Copying META-INF/services directory
➜  2099 apktool b mobile-legends-bang-bang_1.5.32.5811
I: Using Apktool 2.5.1-45c91e-SNAPSHOT
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes3 folder into classes3.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
I: Checking whether sources has changed...
I: Smaling smali_assets folder into assets.dex...
I: Checking whether resources has changed...
I: Building resources...
W: /home/ibotpeaches/Downloads/Apktool/2099/mobile-legends-bang-bang_1.5.32.5811/AndroidManifest.xml:225: error: Error: No resource type specified (at 'resource' with value '@1996816384').
W: 
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_21463752035296188684019496922222712368.tmp, p, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 29, --version-code, 15325811, --version-name, 1.5.32.5811, --no-version-vectors, -F, /tmp/APKTOOL7502002210714033128.tmp, -e, /tmp/APKTOOL8088020546773232565.tmp, -0, arsc, -I, /home/ibotpeaches/.local/share/apktool/framework/1.apk, -S, /home/ibotpeaches/Downloads/Apktool/2099/mobile-legends-bang-bang_1.5.32.5811/res, -M, /home/ibotpeaches/Downloads/Apktool/2099/mobile-legends-bang-bang_1.5.32.5811/AndroidManifest.xml]
➜  2099 

iBotPeaches added a commit that referenced this issue Mar 6, 2021
@Amitkehri
Copy link

Amitkehri commented Mar 23, 2021

Hi @iBotPeaches,

When this fix will roll out in production release ? We are waiting for it. Any tentative timeline ?
Please let us know.

Thanks.

@DRSDavidSoft
Copy link

@iBotPeaches Hi there, In Apktool 2.5.0 I'm getting the same error:

brut.androlib.AndrolibException: Invalid chunk type: expected=0x00000200, got=0x00000203

Is this issue solved in unreleased builds?

@iBotPeaches iBotPeaches added this to the v2.5.1 milestone Mar 26, 2021
@iBotPeaches
Copy link
Owner

@iBotPeaches Hi there, In Apktool 2.5.0 I'm getting the same error:

brut.androlib.AndrolibException: Invalid chunk type: expected=0x00000200, got=0x00000203

Is this issue solved in unreleased builds?

This is in 2.5.1 - not released yet.

@terrynguyen255
Copy link

terrynguyen255 commented Jun 22, 2021

Since 2.5.1 has not released, I worked-around with this tutorial. Hope it helps someone.
https://platinmods.com/threads/how-to-fix-apktool-decompile-error-using-mt-manager-app-arscdecoder-error.121708/

@MeShiraz
Copy link

Still Having this issue, Any update?
Thanks

@hydraxman
Copy link

Update on this?

@iBotPeaches
Copy link
Owner

What is there to update? My last message is clear. It is in 2.5.1.

@hydraxman
Copy link

When will 2.5.1 be released then? @iBotPeaches

@iBotPeaches
Copy link
Owner

When will 2.5.1 be released then? @iBotPeaches

Unknown at this time. There are blockers at play preventing a release and no ETA on fixes.

@hydraxman
Copy link

Thank you! Could you share the commit that fix this, so we can build a hotfix version locally? @iBotPeaches

@iBotPeaches
Copy link
Owner

Thank you! Could you share the commit that fix this, so we can build a hotfix version locally? @iBotPeaches

Sorry man, but this just seems odd. Did you read this bug report you responded to?

I responded earlier with all the details here (#2099 (comment)) and that link included the PR (#2527) that I marked as fixing a good portion of this ticket.

However, why just pluck a singular commit? I'm sure you'll want the other fixes and enhancements in the master branch vs 1 commit for 1 issue. I can't predict what 1 commit applied on top of 2.5.0 will even do.

Then finally, we've been building builds for each commit to master under the "Build" job. You can see the last commit to master job trigged a binary and archived it here - https://github.com/iBotPeaches/Apktool/actions/runs/1002640994 so you don't really need to build them locally. You can test bleeding edge builds for every master commit.

@Amitkehri
Copy link

@iBotPeaches , it would be so nice if you could let me know by when release 2.5.1 will be out. Thanks

@iBotPeaches
Copy link
Owner

@iBotPeaches , it would be so nice if you could let me know by when release 2.5.1 will be out. Thanks

It is hard-blocked forever until Mac builds. AOSP building SDK Tools is becoming quite tough and/or impossible.

@theapache64
Copy link

this is still happening

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests