Apktool: Disassembling and immediately reassembling chokes on resources.

Created on 20 Jun 2018  Â·  2Comments  Â·  Source: iBotPeaches/Apktool

I'm getting the below exception when rebuilding an APK immediately after successfully disassembling it. Processing the dex files into smali and back again seems to work, but reassembling the resources seems to be where the problem happens.

Any advice or suggestions on how to proceed?

Information

  1. Apktool Version (apktool -version)
    _2.3.3_
    _(Java @ 1.8.0u171)_
  2. Operating System (Mac, Linux, Windows)
    _Ubuntu 18.04_
  3. APK From? (Playstore, ROM, Other)
    _Google Play Store_

Stacktrace/Logcat

Full Verbose Output

Gist (raw)

Exception Snippet

Jun 19, 2018 6:24:38 PM java.util.logging.LogManager$RootLogger log
INFO:     (new resource id menu_trip_details from /home/rogwilco/projects/api_discovery/bmw/build/de.bmw.connected.na/res/menu/menu_trip_details.xml)
Jun 19, 2018 6:24:38 PM java.util.logging.LogManager$RootLogger log
INFO:     (new resource id menu_vehicle_screen from /home/rogwilco/projects/api_discovery/bmw/build/de.bmw.connected.na/res/menu/menu_vehicle_screen.xml)
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_4592681073924728553.tmp, p, -v, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 25, --version-code, 4078, --version-name, 5.0.0.4078, --no-version-vectors, -F, /tmp/APKTOOL7152370351952631271.tmp, -0, arsc, -0, png, -0, assets/infowindow_bg.9.png, -0, ctm, -0, mp4, -0, res/drawable-hdpi-v4/abc_ab_share_pack_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_btn_switch_to_on_mtrl_00001.9.png, -0, res/drawable-hdpi-v4/abc_btn_switch_to_on_mtrl_00012.9.png, -0, res/drawable-hdpi-v4/abc_cab_background_top_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_list_divider_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_list_focused_holo.9.png, -0, res/drawable-hdpi-v4/abc_list_longpressed_holo.9.png, -0, res/drawable-hdpi-v4/abc_list_pressed_holo_dark.9.png, -0, res/drawable-hdpi-v4/abc_list_pressed_holo_light.9.png, -0, res/drawable-hdpi-v4/abc_list_selector_disabled_holo_dark.9.png, -0, res/drawable-hdpi-v4/abc_list_selector_disabled_holo_light.9.png, -0, res/drawable-hdpi-v4/abc_menu_hardkey_panel_mtrl_mult.9.png, -0, res/drawable-hdpi-v4/abc_popup_background_mtrl_mult.9.png, -0, res/drawable-hdpi-v4/abc_scrubber_primary_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_scrubber_track_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-hdpi-v4/abc_switch_track_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_tab_indicator_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_textfield_activated_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_textfield_default_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_textfield_search_activated_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/abc_textfield_search_default_mtrl_alpha.9.png, -0, res/drawable-hdpi-v4/common_google_signin_btn_icon_dark_normal_background.9.png, -0, res/drawable-hdpi-v4/common_google_signin_btn_icon_light_normal_background.9.png, -0, res/drawable-hdpi-v4/common_google_signin_btn_text_dark_normal_background.9.png, -0, res/drawable-hdpi-v4/common_google_signin_btn_text_light_normal_background.9.png, -0, res/drawable-hdpi-v4/notification_bg_low_normal.9.png, -0, res/drawable-hdpi-v4/notification_bg_low_pressed.9.png, -0, res/drawable-hdpi-v4/notification_bg_normal.9.png, -0, res/drawable-hdpi-v4/notification_bg_normal_pressed.9.png, -0, res/drawable-ldrtl-hdpi-v17/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-ldrtl-mdpi-v17/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-ldrtl-xhdpi-v17/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-ldrtl-xxhdpi-v17/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-ldrtl-xxxhdpi-v17/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-mdpi-v4/abc_ab_share_pack_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_btn_switch_to_on_mtrl_00001.9.png, -0, res/drawable-mdpi-v4/abc_btn_switch_to_on_mtrl_00012.9.png, -0, res/drawable-mdpi-v4/abc_cab_background_top_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_list_divider_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_list_focused_holo.9.png, -0, res/drawable-mdpi-v4/abc_list_longpressed_holo.9.png, -0, res/drawable-mdpi-v4/abc_list_pressed_holo_dark.9.png, -0, res/drawable-mdpi-v4/abc_list_pressed_holo_light.9.png, -0, res/drawable-mdpi-v4/abc_list_selector_disabled_holo_dark.9.png, -0, res/drawable-mdpi-v4/abc_list_selector_disabled_holo_light.9.png, -0, res/drawable-mdpi-v4/abc_menu_hardkey_panel_mtrl_mult.9.png, -0, res/drawable-mdpi-v4/abc_popup_background_mtrl_mult.9.png, -0, res/drawable-mdpi-v4/abc_scrubber_primary_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_scrubber_track_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-mdpi-v4/abc_switch_track_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_tab_indicator_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_textfield_activated_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_textfield_default_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_textfield_search_activated_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/abc_textfield_search_default_mtrl_alpha.9.png, -0, res/drawable-mdpi-v4/common_google_signin_btn_icon_dark_normal_background.9.png, -0, res/drawable-mdpi-v4/common_google_signin_btn_icon_light_normal_background.9.png, -0, res/drawable-mdpi-v4/common_google_signin_btn_text_dark_normal_background.9.png, -0, res/drawable-mdpi-v4/common_google_signin_btn_text_light_normal_background.9.png, -0, res/drawable-mdpi-v4/notification_bg_low_normal.9.png, -0, res/drawable-mdpi-v4/notification_bg_low_pressed.9.png, -0, res/drawable-mdpi-v4/notification_bg_normal.9.png, -0, res/drawable-mdpi-v4/notification_bg_normal_pressed.9.png, -0, jpeg, -0, jpg, -0, res/drawable-xhdpi-v4/abc_ab_share_pack_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_btn_switch_to_on_mtrl_00001.9.png, -0, res/drawable-xhdpi-v4/abc_btn_switch_to_on_mtrl_00012.9.png, -0, res/drawable-xhdpi-v4/abc_cab_background_top_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_list_divider_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_list_focused_holo.9.png, -0, res/drawable-xhdpi-v4/abc_list_longpressed_holo.9.png, -0, res/drawable-xhdpi-v4/abc_list_pressed_holo_dark.9.png, -0, res/drawable-xhdpi-v4/abc_list_pressed_holo_light.9.png, -0, res/drawable-xhdpi-v4/abc_list_selector_disabled_holo_dark.9.png, -0, res/drawable-xhdpi-v4/abc_list_selector_disabled_holo_light.9.png, -0, res/drawable-xhdpi-v4/abc_menu_hardkey_panel_mtrl_mult.9.png, -0, res/drawable-xhdpi-v4/abc_popup_background_mtrl_mult.9.png, -0, res/drawable-xhdpi-v4/abc_scrubber_primary_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_scrubber_track_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_switch_track_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_tab_indicator_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_textfield_activated_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_textfield_default_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_textfield_search_activated_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/abc_textfield_search_default_mtrl_alpha.9.png, -0, res/drawable-xhdpi-v4/common_google_signin_btn_icon_dark_normal_background.9.png, -0, res/drawable-xhdpi-v4/common_google_signin_btn_icon_light_normal_background.9.png, -0, res/drawable-xhdpi-v4/common_google_signin_btn_text_dark_normal_background.9.png, -0, res/drawable-xhdpi-v4/common_google_signin_btn_text_light_normal_background.9.png, -0, res/drawable-xhdpi-v4/notification_bg_low_normal.9.png, -0, res/drawable-xhdpi-v4/notification_bg_low_pressed.9.png, -0, res/drawable-xhdpi-v4/notification_bg_normal.9.png, -0, res/drawable-xhdpi-v4/notification_bg_normal_pressed.9.png, -0, res/drawable-xxhdpi-v4/abc_ab_share_pack_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_btn_switch_to_on_mtrl_00001.9.png, -0, res/drawable-xxhdpi-v4/abc_btn_switch_to_on_mtrl_00012.9.png, -0, res/drawable-xxhdpi-v4/abc_cab_background_top_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_list_divider_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_list_focused_holo.9.png, -0, res/drawable-xxhdpi-v4/abc_list_longpressed_holo.9.png, -0, res/drawable-xxhdpi-v4/abc_list_pressed_holo_dark.9.png, -0, res/drawable-xxhdpi-v4/abc_list_pressed_holo_light.9.png, -0, res/drawable-xxhdpi-v4/abc_list_selector_disabled_holo_dark.9.png, -0, res/drawable-xxhdpi-v4/abc_list_selector_disabled_holo_light.9.png, -0, res/drawable-xxhdpi-v4/abc_menu_hardkey_panel_mtrl_mult.9.png, -0, res/drawable-xxhdpi-v4/abc_popup_background_mtrl_mult.9.png, -0, res/drawable-xxhdpi-v4/abc_scrubber_primary_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_scrubber_track_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_switch_track_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_tab_indicator_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_textfield_activated_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_textfield_default_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_textfield_search_activated_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_textfield_search_default_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/common_google_signin_btn_icon_dark_normal_background.9.png, -0, res/drawable-xxhdpi-v4/common_google_signin_btn_icon_light_normal_background.9.png, -0, res/drawable-xxhdpi-v4/common_google_signin_btn_text_dark_normal_background.9.png, -0, res/drawable-xxhdpi-v4/common_google_signin_btn_text_light_normal_background.9.png, -0, res/drawable-xxxhdpi-v4/abc_btn_switch_to_on_mtrl_00001.9.png, -0, res/drawable-xxxhdpi-v4/abc_btn_switch_to_on_mtrl_00012.9.png, -0, res/drawable-xxxhdpi-v4/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-xxxhdpi-v4/abc_switch_track_mtrl_alpha.9.png, -0, res/drawable-xxxhdpi-v4/abc_tab_indicator_mtrl_alpha.9.png, -0, mp3, -0, res/raw/joda_atlantic_jan_mayen, -0, res/raw/joda_est, -0, res/raw/joda_etc_gmt, -0, res/raw/joda_etc_gmt_1, -0, res/raw/joda_etc_gmt_10, -0, res/raw/joda_etc_gmt_11, -0, res/raw/joda_etc_gmt_12, -0, res/raw/joda_etc_gmt_13, -0, res/raw/joda_etc_gmt_14, -0, res/raw/joda_etc_gmt_2, -0, res/raw/joda_etc_gmt_3, -0, res/raw/joda_etc_gmt_4, -0, res/raw/joda_etc_gmt_5, -0, res/raw/joda_etc_gmt_6, -0, res/raw/joda_etc_gmt_7, -0, res/raw/joda_etc_gmt_8, -0, res/raw/joda_etc_gmt_9, -0, res/raw/joda_etc_gmtplus1, -0, res/raw/joda_etc_gmtplus10, -0, res/raw/joda_etc_gmtplus11, -0, res/raw/joda_etc_gmtplus12, -0, res/raw/joda_etc_gmtplus2, -0, res/raw/joda_etc_gmtplus3, -0, res/raw/joda_etc_gmtplus4, -0, res/raw/joda_etc_gmtplus5, -0, res/raw/joda_etc_gmtplus6, -0, res/raw/joda_etc_gmtplus7, -0, res/raw/joda_etc_gmtplus8, -0, res/raw/joda_etc_gmtplus9, -0, res/raw/joda_etc_uct, -0, res/raw/joda_etc_utc, -0, res/raw/joda_hst, -0, res/raw/joda_mst, -0, res/raw/joda_pacific_johnston, -0, arsc, -I, /home/rogwilco/.local/share/apktool/framework/1.apk, -S, /home/rogwilco/projects/api_discovery/bmw/build/de.bmw.connected.na/res, -M, /home/rogwilco/projects/api_discovery/bmw/build/de.bmw.connected.na/AndroidManifest.xml]

Steps to Reproduce

  1. apktool d de.bmw.connected.na.apk
  2. apktool b de.bmw.connected.na/ -v

Frameworks

_N/A_

APK

BMW Connected 5.0.0.4078

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything?
    _Yes_
  2. If you are trying to install a modified apk, did you resign it?
    _N/A_
  3. Are you using the latest apktool version?
    _Yes (currently 2.3.3)_

Most helpful comment

The real errors in aapt1 are

W: /Users/connortumbleson/Desktop/Apktool/Bugs/Bug1824/de.bmw.connected_2018-06-04/res/layout/card_smart_access_details.xml:10: error: Error: Integer value out of range (at 'layout_columnSpan' with value '0').
W: /Users/connortumbleson/Desktop/Apktool/Bugs/Bug1824/de.bmw.connected_2018-06-04/res/layout/card_smart_access_details.xml:10: error: Error: Integer value out of range (at 'layout_rowSpan' with value '0').
W: /Users/connortumbleson/Desktop/Apktool/Bugs/Bug1824/de.bmw.connected_2018-06-04/res/layout/card_smart_access_details.xml:14: error: Error: Integer value out of range (at 'layout_rowSpan' with value '0').
W: /Users/connortumbleson/Desktop/Apktool/Bugs/Bug1824/de.bmw.connected_2018-06-04/res/layout/card_smart_access_details.xml:18: error: Error: Integer value out of range (at 'layout_columnSpan' with value '0').

This made me think a strict validation in aapt1, that is no longer in aapt2.

➜  Bug1824 apktool b de.bmw.connected_2018-06-04 -f --use-aapt2
I: Using Apktool 2.3.4-92bec5-SNAPSHOT
I: Smaling smali folder into classes.dex...
I: Smaling smali_classes3 folder into classes3.dex...
I: Smaling smali_classes2 folder into classes2.dex...
I: Building resources...
I: Copying libs... (/lib)
I: Copying libs... (/kotlin)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk...
➜  Bug1824 

Yep, aapt1 will not work for this application.

All 2 comments

Please excuse my ignorance if you already stated so but, what exactly are you attempting/have you attempted to do?

To me, it just looks like you're stating that you decompiled okay and are having trouble recompiling without stating what your trying to/have done exactly that resulted in the issues with recompiling.

The real errors in aapt1 are

W: /Users/connortumbleson/Desktop/Apktool/Bugs/Bug1824/de.bmw.connected_2018-06-04/res/layout/card_smart_access_details.xml:10: error: Error: Integer value out of range (at 'layout_columnSpan' with value '0').
W: /Users/connortumbleson/Desktop/Apktool/Bugs/Bug1824/de.bmw.connected_2018-06-04/res/layout/card_smart_access_details.xml:10: error: Error: Integer value out of range (at 'layout_rowSpan' with value '0').
W: /Users/connortumbleson/Desktop/Apktool/Bugs/Bug1824/de.bmw.connected_2018-06-04/res/layout/card_smart_access_details.xml:14: error: Error: Integer value out of range (at 'layout_rowSpan' with value '0').
W: /Users/connortumbleson/Desktop/Apktool/Bugs/Bug1824/de.bmw.connected_2018-06-04/res/layout/card_smart_access_details.xml:18: error: Error: Integer value out of range (at 'layout_columnSpan' with value '0').

This made me think a strict validation in aapt1, that is no longer in aapt2.

➜  Bug1824 apktool b de.bmw.connected_2018-06-04 -f --use-aapt2
I: Using Apktool 2.3.4-92bec5-SNAPSHOT
I: Smaling smali folder into classes.dex...
I: Smaling smali_classes3 folder into classes3.dex...
I: Smaling smali_classes2 folder into classes2.dex...
I: Building resources...
I: Copying libs... (/lib)
I: Copying libs... (/kotlin)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk...
➜  Bug1824 

Yep, aapt1 will not work for this application.

Was this page helpful?
0 / 5 - 0 ratings