Apktool icon indicating copy to clipboard operation
Apktool copied to clipboard

[BUG] Errors while building Facebook Messenger

Open OmarBazaraa opened this issue 1 year ago • 3 comments
trafficstars

I'm trying to recompile Facebook Messenger using apktool but I keep getting errors in the resource building step. It mainly keeps complaining about resources ending with 2 or 2s (e.g., color2, color2s, drawable2, layout2, ..etc.).

I tried deleting the files causing the errors but I keep getting more and more that I had to delete almost everything and yet it's still complaining.

Note: I need to edit some resources so using the --no-res option won't work for me.

Information

  • Apktool Version: 2.9.0
  • Java Version: 21.0.1
  • Operating System: Windows 11
  • APK From: Play Store & APK Mirror

Stacktrace

Initial stacktrace...

> apktool b -f --use-aapt2 -o .\messenger_patched.apk .\messenger-v310.0.0.20.117-armeabi-v7a\

I: Using Apktool 2.9.0
I: Smaling smali folder into classes.dex...
I: Smaling smali_assets folder into assets.dex...
I: Smaling smali_classes2 folder into classes2.dex...
I: Smaling smali_classes3 folder into classes3.dex...
I: Smaling smali_classes4 folder into classes4.dex...
I: Smaling smali_classes5 folder into classes5.dex...
I: Smaling smali_classes6 folder into classes6.dex...
I: Smaling smali_classes7 folder into classes7.dex...
I: Building resources...
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f150002.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f150003.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f150006.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f150007.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f150008.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f150009.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f15000a.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f15000b.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f15000c.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f15000f.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f150010.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f15006a.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f15006b.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f1500a3.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f1500b0.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f1500b8.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f1500bf.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f1500d0.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f1500d8.xml'.
W: error: invalid file path 'D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res\color2\APKTOOL_DUMMYVAL_0x7f1500dd.xml'.
brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\ombazara\AppData\Local\Temp\brut_util_Jar_87401739205512981675733392342153724296.tmp, compile, --dir, D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\res, --legacy, -o, D:\Android\custom-scripts\data\.\messenger-v310.0.0.20.117-armeabi-v7a\build\resources.zip]

Steps to Reproduce

Just try decompiling then compiling back the APK and you will get these errors.

  1. apktool d -f --use-aapt2 <apk-path>
  2. apktool b -f --use-aapt2 <apk-deassembled-path>

APK

I tried various versions of Facebook Messenger and I get the same errors in all of them. Here is an example APK.

Questions to ask before submission

  • Have you tried apktool d, apktool b without changing anything? YES
  • Are you using the latest apktool version? YES

OmarBazaraa avatar Nov 23 '23 16:11 OmarBazaraa

this may can help #1719 try rename color2 to color

GotKiCry avatar Dec 01 '23 10:12 GotKiCry

Not positive on path forward on this. So to be blunt - it may sit for quite a while. We adjusted disassembly process to just handle the "2" part of the types. So now of course on the build end - that is causing an issue.

If we go forward with renaming them back to non-plural, then that might have to occur during disassembly.

iBotPeaches avatar Dec 02 '23 12:12 iBotPeaches

Not positive on path forward on this. So to be blunt - it may sit for quite a while. We adjusted disassembly process to just handle the "2" part of the types. So now of course on the build end - that is causing an issue.

If we go forward with renaming them back to non-plural, then that might have to occur during disassembly.

Hello, is that planning to be fixed in upcoming months? Or not really important right now? I'm also trying to recompile some Meta apps so I can bypass SSL pinning.

gringobratan avatar Apr 16 '24 07:04 gringobratan