-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[BUG] Resource not found trying to recompile with no changes #2980
Comments
Not sure what is happening here. All resources are named - <attr name="APKTOOL_DUPLICATE_attr_0x7f04027b">
<flag name="0_resource_name_obfuscated" value="0x00000002" />
<flag name="APKTOOL_DUPLICATE_id_0x7f0b0003" value="0x00001000" />
<flag name="APKTOOL_DUPLICATE_id_0x7f0b0004" value="0x00000008" />
<flag name="APKTOOL_DUPLICATE_id_0x7f0b0006" value="0x00010000" />
<flag name="APKTOOL_DUPLICATE_id_0x7f0b0009" value="0x00000001" />
<flag name="APKTOOL_DUPLICATE_id_0x7f0b000d" value="0x00000004" />
</attr> So in a regular application - we trust the named attributes. I wonder if we have some sort logic issue here with renaming of attributes in such a way that we mark the original attribute ( That however, is not valid. There is only 1 reference for that ID
However, we key the resources by the type, but look for them via the name specific to that type. So that might be our cause, since we might have the |
Nah wasn't that. Will backlog this, not sure. <public type="anim" name="0_resource_name_obfuscated" id="0x7f010002" />
<public type="animator" name="0_resource_name_obfuscated" id="0x7f020000" />
<public type="array" name="0_resource_name_obfuscated" id="0x7f030000" />
<public type="attr" name="0_resource_name_obfuscated" id="0x7f040000" />
<public type="bool" name="0_resource_name_obfuscated" id="0x7f050000" />
<public type="color" name="0_resource_name_obfuscated" id="0x7f060000" />
<public type="dimen" name="0_resource_name_obfuscated" id="0x7f070000" />
<public type="drawable" name="0_resource_name_obfuscated" id="0x7f080000" />
<public type="font" name="0_resource_name_obfuscated" id="0x7f090000" />
<public type="fraction" name="0_resource_name_obfuscated" id="0x7f0a0000" />
<public type="id" name="0_resource_name_obfuscated" id="0x7f0b0000" />
<public type="integer" name="0_resource_name_obfuscated" id="0x7f0c0000" />
<public type="interpolator" name="0_resource_name_obfuscated" id="0x7f0d0000" />
<public type="layout" name="0_resource_name_obfuscated" id="0x7f0e0000" />
<public type="menu" name="0_resource_name_obfuscated" id="0x7f100002" />
<public type="mipmap" name="0_resource_name_obfuscated" id="0x7f110001" />
<public type="plurals" name="0_resource_name_obfuscated" id="0x7f120000" />
<public type="raw" name="0_resource_name_obfuscated" id="0x7f130000" />
<public type="string" name="0_resource_name_obfuscated" id="0x7f140001" />
<public type="style" name="0_resource_name_obfuscated" id="0x7f150000" />
<public type="xml" name="0_resource_name_obfuscated" id="0x7f170000" /> |
Thank you for your attention to this, your work is much appreciated! |
A very similar issue happens when trying to decompile and recompile (no changes) the latest version (34.4.16-21) of the Play Store (single apk, no bundle, downloaded from ApkMirror).
|
The build tool The workaround I have is to add the following line to constructor of
i.e. duplicate the existing logic for the case where the resource name is "(name removed)". This lets apktool generate unique dummy IDs instead of hundreds of clashes. With this change I am now able to recompile the latest Google Chrome .apk. |
thanks @reubenscratton for the tip on aapt2 feature. Will help to make a POC and tweak Apktool for this. |
No problem, glad to help. Thanks for creating such an awesomely useful tool. FWIW Google's own apps will often be the first to use new tools changes that might break apktool. If you have an automated testing pipeline it might be worth scripting something that downloads the latest chrome/play/etc .apks and rebuilds them. Just a thought. |
@reubenscratton thank you for finding this! I just built apktool with the change you suggested in brut.androlib.res.data.ResResSpec and I can confirm gboard now succesfully roundtrips. |
Thanks for tip. Started a PR for this change to support the various forms that aapt uses to strip attribute names. |
Hi @purpleman2k, does your modified gboard actually run? I've been working on rebuilding Google Chrome and am in a world of pain. For some reason XML resources aren't loading properly - the core framework seems unable to resolve any attribute IDs to values. This could be because this fix needs more work, or it could be a consequence of my changing the package name (unavoidable cos Chrome is a system app). |
@reubenscratton
But I can't be sure if this error is the actual issue and if it is -- is it a result of something in apktool. If anyone has insight, that'd be awesome. Thanks! |
It doesn't look like an apktool issue so far. You must have changed the package ID (to 'com.testing.android.inputmethod.latin'), but presumably GBoard requires Google Play Services to run and the relevant system process doesn't recognise your app. You may need to set up API access in the Play Console... see https://developers.google.com/android/guides/client-auth for what needs doing. You'll have to take a guess as to what Google APIs GBoard needs. |
Information
When trying to de/recompile gboard with no changes, error message indicates that some resources that are referenced in the xmls are not found (I assume 'declared'). Judging by the name of the referenced resource it appears that the name was obfuscated -- that's fine, I don't need the original name, but I see that the actual resource it's complaining about (with the obfuscated name) doesn't exist in the relevant XML where it needs to be declared.
For example, "id/0_resource_name_obfuscated" which should be declared in ids.xml just isn't there.
Stacktrace/Logcat
Steps to Reproduce
Frameworks
N/A
APK
If this APK can be freely shared, please upload/attach a link to it.
https://m.apkpure.com/gboard-the-google-keyboard/com.google.android.inputmethod.latin/download/102451614-APK
Questions to ask before submission
apktool d
,apktool b
without changing anything? YesThe text was updated successfully, but these errors were encountered: