iBotPeaches / Apktool

A tool for reverse engineering Android apk files
https://apktool.org/
Apache License 2.0
19.84k stars 3.56k forks source link

[BUG] Error parsing XML: mismatched tag #2594

Open XhstormR opened 3 years ago

XhstormR commented 3 years ago

Information

  1. Apktool Version (apktool -version) - v2.5.0
  2. Operating System (Mac, Linux, Windows) - Windows
  3. APK From? (Playstore, ROM, Other) - Other: GitHub release

Stacktrace/Logcat

Include stacktrace here
D:\Download\11>java -jar apktool_2.5.0.jar d app-fdroid-release.apk
I: Using Apktool 2.5.0 on app-fdroid-release.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\leo\AppData\Local\apktool\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I: Copying META-INF/services directory

D:\Download\11>java -jar apktool_2.5.0.jar b app-fdroid-release
I: Using Apktool 2.5.0
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
W: D:\Download\11\app-fdroid-release\res\values\strings.xml:3272: error: Error parsing XML: mismatched tag
W:
W: D:\Download\11\app-fdroid-release\res\values-ja\strings.xml:539: error: Error parsing XML: mismatched tag
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\leo\AppData\Local\Temp\brut_util_Jar_177350159491124750776342583572495634038.tmp, p, --forced-package-id, 127, --min-sdk-version, 14, --target-sdk-version, 29, --version-code, 95, --version-name, 3.6.1, --no-version-vectors, -F, C:\Users\leo\AppData\Local\Temp\APKTOOL14125297561695249724.tmp, -e, C:\Users\leo\AppData\Local\Temp\APKTOOL11493067484074361526.tmp, -0, arsc, -I, C:\Users\leo\AppData\Local\apktool\framework\1.apk, -S, D:\Download\11\app-fdroid-release\res, -M, D:\Download\11\app-fdroid-release\AndroidManifest.xml]
W:
W: D:\Download\11\app-fdroid-release\res\values-id\strings.xml:482: error: Error parsing XML: mismatched tag

Steps to Reproduce

  1. java -jar apktool_2.5.0.jar d app-fdroid-release.apk
  2. java -jar apktool_2.5.0.jar b app-fdroid-release

Frameworks

If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files (.apks that live in /system/framework or /system/priv-app)

APK

If this APK can be freely shared, please upload/attach a link to it. Download it from GitHub:
https://github.com/TeamAmaze/AmazeFileManager/releases/tag/v3.6.1

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? Didn't go so far.
  3. Are you using the latest apktool version? Yes.
XhstormR commented 3 years ago

It looks because of the HTML string, resulting in no closed XML tag:

剪贴板04

Maybe we can use <![CDATA[]]>.

iBotPeaches commented 3 years ago

Maybe we can use <![CDATA[]]>.

I don't know if there is a sure fire way to determine that. Since CDATA takes everything literal, I'm not sure without crawling the string if any references exist to variables. I guess maybe the spec allows us to open CDATA and close it before each variable, so I'll hold this for now until I can do more research.

XhstormR commented 3 years ago

Related to https://github.com/iBotPeaches/Apktool/issues/1685