Apktool
Apktool copied to clipboard
Windows: mapping between unknown chars & valid chars
Information
- **Apktool Version (
apktool -version) - 2.2.2 - **Operating System (Mac, Linux, Windows) - Windows
- **APK From? (Playstore, ROM, Other) - URL: http://files.nabstudio.com/mangarock/mangarock-definitive-v1.9.9-RELEASE.apk?cfcache=1
Stacktrace/Logcat
>apktool d "G:\mangarock.apk" --keep-broken-res -f
I: Using Apktool 2.2.2 on mangarock.apk
I: Loading resource table...
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f070000
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f070001
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f070002
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f070003
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f070004
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f070005
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f070006
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f070007
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f070008
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f070009
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f07000a
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f07000b
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f07000c
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f07000d
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f07000e
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f07000f
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f070010
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f070011
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f070012
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f07003d
W: Duplicate Resource Detected. Ignoring duplicate: string-sr/APKTOOL_DUMMYVAL_0x7f07003e
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: ~\AppData\Local\apktool\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Copying assets and libs...
I: Copying unknown files...
Exception in thread "main" brut.androlib.AndrolibException: brut.directory.DirectoryException: Error copying file: ??♀.xml
at brut.androlib.Androlib.decodeUnknownFiles(Androlib.java:217)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:158)
at brut.apktool.Main.cmdDecode(Main.java:166)
at brut.apktool.Main.main(Main.java:81)
Caused by: brut.directory.DirectoryException: Error copying file: ??♀.xml
at brut.directory.DirUtil.copyToDir(DirUtil.java:88)
at brut.directory.AbstractDirectory.copyToDir(AbstractDirectory.java:207
)
at brut.androlib.Androlib.decodeUnknownFiles(Androlib.java:210)
... 3 more
Caused by: java.io.FileNotFoundException: \mangarock\unknown\??♀.xml (The filename, directory name, or volume label syntax is incorrect)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at brut.directory.DirUtil.copyToDir(DirUtil.java:84)
... 5 more
Steps to Reproduce
- apktool d "G:\mangarock.apk" --keep-broken-res -f
APK
http://files.nabstudio.com/mangarock/mangarock-definitive-v1.9.9-RELEASE.apk?cfcache=1
Questions to ask before submission
- Have you tried
apktool d,apktool bwithout changing anything? YES - If you are trying to install a modified apk, did you resign it? N/A
- Are you using the latest apktool version? YES
This is a duplicate of #1314 , but I closed that one for being a Windows problem. There is no short term fix for this. The work required to create a lookup table of filenames, yet save them back into the apk as the original string is a ton of work.
So that is why I closed the report, use unix/mac until then.
The common and easy way would be to build a white-list of characters which are supported on all platforms/current platform in file-names. Additionally a blacklist of forbidden file-names can be created.
Everything that does not match the whitelist or terms from the blacklist is escaped:
For example:
&is escaped to&- [unicode] characters could be URL encoded © ->
© - forbidden file names like
CON->&!CON;
Then you don't have to store a mapping somewhere. For compatibility with decompiled directories created by older apktool versions you can add a flag in apktool.yml that enabled/disabled escaping and if the option is missing this means escaping is disabled.
And when running on Windows for solving the case sensitivity problem on NTFS drives you could run fsutil.exe file SetCaseSensitiveInfo C:\folder\path enable to enable case sensitivity of the extraction directory.
This would be all solved if Windows ever supported EXT drives
@KarmaMod I don't see a relation between the file-system and disallowed files like CON. Even if Windows would support EXT drives those files will most likely still be unsupported.