Apktool: Error parsing XML: not well-formed (invalid token)
Information
- Apktool Version: 2.2.1
- Operating System: Both Linux and Windows
- APK From: Playstore (https://play.google.com/store/apps/details?id=com.musixmatch.android.lyrify&hl=en)
Steps to Reproduce
- Download apk from (https://apkpure.com/musixmatch-lyrics-and-music/com.musixmatch.android.lyrify)
- Decompile apk using
apktool d music.apk -o output
(You will notice non-ascii characters in decompiled files both Smali and XML files which probably the reason recompiling fails) - Try to recompile the output using
apktool b output
, it would fail leaving the following errors
I: Using Apktool 2.2.1
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
W: /output/res/layout/abc_action_mode_bar.xml:2: error: Error parsing XML: not well-formed (invalid token)
W:
W: /output/res/layout/abc_action_mode_close_item_material.xml:2: error: No resource identifier found for attribute 'srcCompat' in package 'android'
W:
W: /output/res/layout/abc_dialog_title_material.xml:2: error: Error parsing XML: not well-formed (invalid token)
W:
W: /output/res/layout-v17/abc_dialog_title_material.xml:2: error: Error parsing XML: not well-formed (invalid token)
W:
W: /output/res/layout/abc_screen_simple.xml:2: error: Error parsing XML: not well-formed (invalid token)
W:
W: /output/res/layout/abc_screen_simple_overlay_action_mode.xml:5: error: Error parsing XML: not well-formed (invalid token)
W:
W: /output/res/layout/abc_screen_toolbar.xml:2: error: Error parsing XML: not well-formed (invalid token)
W:
W: /output/res/layout-v21/abc_screen_toolbar.xml:2: error: Error parsing XML: not well-formed (invalid token)
W:
W: /output/res/layout/com_facebook_device_auth_dialog_fragment.xml:8: error: Error parsing XML: not well-formed (invalid token)
W:
W: /output/res/layout-v16/com_facebook_device_auth_dialog_fragment.xml:8: error: Error parsing XML: not well-formed (invalid token)
W:
W: /output/res/layout-v17/com_facebook_device_auth_dialog_fragment.xml:8: error: Error parsing XML: not well-formed (invalid token)
W:
W: /output/res/layout/com_facebook_smart_device_dialog_fragment.xml:8: error: Error parsing XML: not well-formed (invalid token)
W:
W: /output/res/layout-v16/com_facebook_smart_device_dialog_fragment.xml:8: error: Error parsing XML: not well-formed (invalid token)
W:
W: /output/res/layout-v17/com_facebook_smart_device_dialog_fragment.xml:8: error: Error parsing XML: not well-formed (invalid token)
W:
W: /output/res/layout/design_bottom_navigation_item.xml:5: error: Error parsing XML: not well-formed (invalid token)
W:
W: /output/res/layout/design_bottom_sheet_dialog.xml:5: error: No resource identifier found for attribute 'layout_behavior' in package 'android'
W:
W: /output/res/layout-v16/design_bottom_sheet_dialog.xml:5: error: No resource identifier found for attribute 'layout_behavior' in package 'android'
W:
W: /output/res/layout/design_text_input_password_icon.xml:2: error: Error parsing XML: not well-formed (invalid token)
W:
.....................
APK
Musixmatch Lyrics (https://play.google.com/store/apps/details?id=com.musixmatch.android.lyrify&hl=en)
Questions to ask before submission
- Have you tried
apktool d
,apktool b
without changing anything? - Yes - If you are trying to install a modified apk, did you resign it? -No
- Are you using the latest apktool version? -Yes
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 1
- Comments: 25 (6 by maintainers)
Happens for me with resource xml with
$
in tag name, e.g.Ticket looks open and unresolved to me. So no isn’t resolved.
2020 update. Still an issue.
@iBotPeaches couldn’t you - optionally - pass some params to the XML tool so that it ignores these errors? The XML format errors come from the source APK so they’re probably OK with those errors.
That is in aapt/aapt2 so you won’t find it. You’ll want to check
I have not done enough research to know if that is true. So unsure.
FWIW, this seems to come down to a bug in libexpat which doesn’t allow the proper character set for names. When a XML resources refers to proguarded names, it has good chances to crash. See https://github.com/libexpat/libexpat/issues/171