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

Error parsing XML: not well-formed (invalid token) #885

Closed
iBotPeaches opened this Issue Mar 18, 2015 · 11 comments

Comments

Projects
None yet
3 participants
@iBotPeaches
Owner

iBotPeaches commented Mar 18, 2015

Original issue 776 created by kefir500 on 2015-03-04T10:57:38.000Z:

What steps will reproduce the problem?

What is the expected output? What do you see instead?

warning: string 'pref_map_show_center_cross' has no default translation.
warning: string 'pref_map_show_center_cross_desc' has no default translation.

C:\Apktool\res\layout\abc_action_menu_layout.xml:2: error: Error parsing XML: not well-formed (invalid token)

C:\Apktool\res\layout\abc_action_mode_bar.xml:2: error: Error parsing XML: not well-formed (invalid token)

C:\Apktool\res\layout\abc_activity_chooser_view.xml:2: error: Error parsing XML: not well-formed (invalid token)

--- And 5 more similar errors ---

C:\Apktool\res\layout\fragment_track_record.xml:24: error: No resource identifier found for attribute 'pw_text' in package 'android'

C:\Apktool\res\layout\fragment_track_record.xml:24: error: No resource identifier found for attribute 'pw_textSize' in package 'android'

C:\Apktool\res\layout\fragment_track_record.xml:24: error: No resource identifier found for attribute 'pw_barColor' in package 'android'

-- And >10 similar errors ---

C:\Apktool\res\layout\view_color_picker_basic_tab.xml:5: error: Error parsing XML: duplicate attribute

What version of the product are you using? On what operating system?

  • Apktool RC4
  • aapt.exe (from the Apktool GitHub repository)

Please provide any additional information below.
Seems that XML tags are corrupt. Tried to fix these XML tags manually - no luck. Also tried different aapt and Apktool releases - still the same. Removing "framework/1.apk" does not help.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #1 originally posted by connor.tumbleson on 2015-03-11T12:25:18.000Z:

Yeah no idea what this is. There are some strange characters in the layout files.

<o.ᴗ android:gravity

Dumping out the resources via aapt

ibotpeaches@raganok:~/Downloads/Apktool/Bug776$ aapt d xmltree locus.apk res/layout/abc_action_menu_layout.xml
N: android=http://schemas.android.com/apk/res/android
N: app=http://schemas.android.com/apk/res-auto
E: o.ᴗ (line=17)

Yields the same weird character. Needs more investigation.

Owner

iBotPeaches commented Mar 18, 2015

Comment #1 originally posted by connor.tumbleson on 2015-03-11T12:25:18.000Z:

Yeah no idea what this is. There are some strange characters in the layout files.

<o.ᴗ android:gravity

Dumping out the resources via aapt

ibotpeaches@raganok:~/Downloads/Apktool/Bug776$ aapt d xmltree locus.apk res/layout/abc_action_menu_layout.xml
N: android=http://schemas.android.com/apk/res/android
N: app=http://schemas.android.com/apk/res-auto
E: o.ᴗ (line=17)

Yields the same weird character. Needs more investigation.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #2 originally posted by Liquid.St.Ray on 2015-03-13T23:20:00.000Z:

The unknow tag name is actually the full qualified name of a custom UI class, which has been obfuscated. I suffered the same issue and I found the symbol in smali files.
I think this could be a common case for lots of commerical apps.

Owner

iBotPeaches commented Mar 18, 2015

Comment #2 originally posted by Liquid.St.Ray on 2015-03-13T23:20:00.000Z:

The unknow tag name is actually the full qualified name of a custom UI class, which has been obfuscated. I suffered the same issue and I found the symbol in smali files.
I think this could be a common case for lots of commerical apps.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #3 originally posted by connor.tumbleson on 2015-03-13T23:21:51.000Z:

Is this from a certain ROM/OEM then? How does an obfuscated resource work without being de-obfuscated prior to use?

Its not like Android knows this mapping of obfuscation -> real resource names.

Owner

iBotPeaches commented Mar 18, 2015

Comment #3 originally posted by connor.tumbleson on 2015-03-13T23:21:51.000Z:

Is this from a certain ROM/OEM then? How does an obfuscated resource work without being de-obfuscated prior to use?

Its not like Android knows this mapping of obfuscation -> real resource names.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #4 originally posted by Liquid.St.Ray on 2015-03-13T23:52:04.000Z:

Should be some unexpected characters was introduced in the obfuscation and AAPT is complaining about it.

I tried to rename a custom UI component class using unexpected characters and suffered the same issue when building the APK file.

That APK could be packed with custom built AAPT I think.

Owner

iBotPeaches commented Mar 18, 2015

Comment #4 originally posted by Liquid.St.Ray on 2015-03-13T23:52:04.000Z:

Should be some unexpected characters was introduced in the obfuscation and AAPT is complaining about it.

I tried to rename a custom UI component class using unexpected characters and suffered the same issue when building the APK file.

That APK could be packed with custom built AAPT I think.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #5 originally posted by Liquid.St.Ray on 2015-03-14T00:18:07.000Z:

DexGuard could generate non-ASCII characters for class/method/field names, which is not supported by stock AAPT.

Owner

iBotPeaches commented Mar 18, 2015

Comment #5 originally posted by Liquid.St.Ray on 2015-03-14T00:18:07.000Z:

DexGuard could generate non-ASCII characters for class/method/field names, which is not supported by stock AAPT.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #6 originally posted by connor.tumbleson on 2015-03-14T00:20:05.000Z:

aapt is all about resources. It doesn't manage the source (java) at all, so those points aren't relatable.

Owner

iBotPeaches commented Mar 18, 2015

Comment #6 originally posted by connor.tumbleson on 2015-03-14T00:20:05.000Z:

aapt is all about resources. It doesn't manage the source (java) at all, so those points aren't relatable.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #7 originally posted by Liquid.St.Ray on 2015-03-14T00:25:04.000Z:

You can claim a custom UI class (TextView for example) and reference it in the layout xml file. In this case it would involve compiled resoruce file.

Once that class was obfuscate by something like DexGuard, the class reference in layout xml file would be modified as well.

Owner

iBotPeaches commented Mar 18, 2015

Comment #7 originally posted by Liquid.St.Ray on 2015-03-14T00:25:04.000Z:

You can claim a custom UI class (TextView for example) and reference it in the layout xml file. In this case it would involve compiled resoruce file.

Once that class was obfuscate by something like DexGuard, the class reference in layout xml file would be modified as well.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #8 originally posted by connor.tumbleson on 2015-03-14T00:50:24.000Z:

Ah true true. Custom UI classes then are just localized mapping in an application. So it doesn't matter if the naming is Foo or some crazy UTF8 character.

The question remains AAPT is obviously not liking it. So as you said a custom AAPT must be used. With that being said, do you have any information on this? I looked around there website (Dexguard/Proguard) and couldn't find anything.

Owner

iBotPeaches commented Mar 18, 2015

Comment #8 originally posted by connor.tumbleson on 2015-03-14T00:50:24.000Z:

Ah true true. Custom UI classes then are just localized mapping in an application. So it doesn't matter if the naming is Foo or some crazy UTF8 character.

The question remains AAPT is obviously not liking it. So as you said a custom AAPT must be used. With that being said, do you have any information on this? I looked around there website (Dexguard/Proguard) and couldn't find anything.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Mar 18, 2015

Owner

Comment #9 originally posted by alkorware on 2015-03-14T18:33:01.000Z:

it's 100% dexguard's obfuscation.

Owner

iBotPeaches commented Mar 18, 2015

Comment #9 originally posted by alkorware on 2015-03-14T18:33:01.000Z:

it's 100% dexguard's obfuscation.

@ddccffvv

This comment has been minimized.

Show comment
Hide comment
@ddccffvv

ddccffvv May 24, 2016

Would it be possible to work around this by just renaming the classes to unique [a-Z*] names and updating the references (during/after decompilation)?

Would it be possible to work around this by just renaming the classes to unique [a-Z*] names and updating the references (during/after decompilation)?

@jack16099

This comment has been minimized.

Show comment
Hide comment
@jack16099

jack16099 Dec 17, 2016

Is this issue fixed? I think I've seen some modded apps which gives the same error on latest version of apktool and there's those illegal characters in the manifest. If I'm not wrong that it's modded, how did they do it if apktool can't?

Is this issue fixed? I think I've seen some modded apps which gives the same error on latest version of apktool and there's those illegal characters in the manifest. If I'm not wrong that it's modded, how did they do it if apktool can't?

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