-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
no compile. error "duplicate symbol '@null'." in attrs.xml [BUG] #2836
Comments
Confirmed. Marking as bug. |
Reverting commit dc3667d fixes the issue. Might be worth looking into that commit. |
This reverts commit dc3667d until related issue iBotPeaches#2836 is solved.
Same issue on apktool 2.7.0 (Linux) with this APK |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="actionBarDivider" format="reference" />
<attr name="actionBarItemBackground" format="reference" />
<attr name="actionBarPopupTheme" format="reference" />
<attr name="actionBarSize" format="dimension">
<enum name="@null" value="0" />
</attr> Did a bit of research while running through all issues. Looks like we have a flaw in decoding where our name resolves to |
Had an hour before work. Things I discovered.
However, compare 2.7.0, 2.8.0 and 2.8.1 and you'll find its only the regressions to the apktool.yml that show up. The sparse chunk parsing broke the missing res spec parser as we don't properly pad fake resources for ones we fail to decode. This actually worked way more in our favor, but it seems the legacy behavior of padding is what worked here. So my takeaways and current focus:
|
This comment was marked as off-topic.
This comment was marked as off-topic.
@cpereirarafa - Why do you say that? I don't see any of the similar crash with that application. |
I spent some time with this and have a patch locally, but I'm not positive if its the right choice. What is happening is the resourceId given we either cannot resolve (or its legit This works for the first resource, but as you see becomes duplicate symbols. I've debated a few paths and they all kinda suck.
<attr name="actionBarDivider" formats="reference" />
<attr name="actionBarItemBackground" formats="reference" />
<attr name="actionBarPopupTheme" formats="reference" />
<attr name="actionBarSize" formats="dimension">
<enum name="res0x7f090459" value="0" />
</attr> This instead of the existing: <attr name="actionBarDivider" format="reference" />
<attr name="actionBarItemBackground" format="reference" />
<attr name="actionBarPopupTheme" format="reference" />
<attr name="actionBarSize" format="dimension">
<enum name="@null" value="0" />
</attr>
``` |
tldr - I am bringing back dummy resources. long version.
Take a sample in this issue. We have a resource above known as
So prior to the sparse fixes for a sparse resource table. We to an extreme point padded each res type full of unknown resources. Once we parsed one - we'd simply remove that one from the pool. So once the parsing was done we'd synthesize and create these dummies at the end. Once done we had an entire pool of resources of dummy resources mixed in at the end with the real resources. This would come into handy above because instead when we disassemble the name of a resources and can't find it - we'd fallback to an apktool dummy resource. This was accidentally broken during the move to sparse resources years ago - dc3667d, but it was already "kinda" broken at that point due some regressions when aapt2 came along. We just have to be very careful bringing back dummy resources as they caused a fair share of issues with the more restricted aapt2. When you are making fake/dummy resources you'd think matching the type is the best, but how do you make a fake type of say like dimension/float? You could do 0, etc but it was safer to introduce a reference to a resource that resolved to null. This was patched with removal of dummies with a simple encoding to "@null" and worked quite well. Where it fell apart is what you see here and other places is we replaced the name with "@null" as well - that is completely invalid. |
@iBotPeaches Apart from the issue commented on #3183 (comment), that I have changed as commented and worked, several of the resources in attrs.xml on the binance application are resolved to @null, I will leave the log below.
The attrs.xml: The commands (executing from intellij): The binance version is 2.69.3 |
Thanks @cpereirarafa - that does look similar. I'm experimenting with skipping unknown resources entirely while I work on bringing dummies back if you want to give it a spin - #3309 I'm guessing that PR will fail miserably because we remove resources at write-time and they made be needed somewhere. |
On merge of this: #3318 This will close this issue. That might not get you all the way to a recompilation, but I feel the original reported issue is now resolved between the few samples provided. As all the samples have slightly different failures after this resolution. We can track those elsewhere. |
Information
apktool -version
) -2.6.1Stacktrace/Logcat'
all log
Steps to Reproduce
Disassembly and compile without changes
Frameworks
https://drive.google.com/file/d/1CrZKjC0L_pvjm6Rp-Zt_804U80bqe1uv/view?usp=sharing
APK
https://drive.google.com/file/d/1XA3UTWS91GeF72Gdfj852ZLQIZc5kWkw/view?usp=sharing (settings app)
Questions to ask before submission
apktool d
,apktool b
without changing anything? yesThe text was updated successfully, but these errors were encountered: