Apktool: Invalid chunk type

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)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 11
  • Comments: 22 (8 by maintainers)

Commits related to this issue

Most upvoted comments

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.

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 (https://github.com/iBotPeaches/Apktool/issues/2099#issuecomment-791965193) and that link included the PR (https://github.com/iBotPeaches/Apktool/pull/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.

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

This is partially fixed so I’m closing this ticket. It now decodes without issue after the merge of https://github.com/iBotPeaches/Apktool/pull/2527

However, it as shown below has multiple packages per resources.arsc which is an ongoing issue being tracked here - https://github.com/iBotPeaches/Apktool/issues/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