question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Apktool and dummy values (once for all)

See original GitHub issue

Information

  1. Apktool Version (apktool-2.4.0) and (apktool-2.3.2)
  2. **Operating System ** - Windows
  3. **APK From? ** - ROM (Android 9)

Stacktrace/Logcat (with aapt2)

I: Using Apktool 2.3.2
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2522: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2523: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2524: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2525: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2526: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2527: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2528: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2529: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2530: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2531: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2532: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2533: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2534: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2535: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2536: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2537: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2538: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2539: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2540: error: invalid value for type 'attr'. Expected a reference.
W: C:\Users\universite\Desktop\Andrew\AmbiantDisplay\framework-res\res\values\at
trs.xml:2541: error: invalid value for type 'attr'. Expected a reference.
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit
 code = 1): [C:\Users\UNIVER~1\AppData\Local\Temp\brut_util_Jar_1529674947460288
5286.tmp, compile, --dir, C:\Users\universite\Desktop\Andrew\AmbiantDisplay\fram
ework-res\res, --legacy, -o, C:\Users\universite\Desktop\Andrew\AmbiantDisplay\f
ramework-res\build\resources.zip]

Stacktrace/Logcat (without aapt2)

I: Using Apktool 2.3.2
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
brut.androlib.AndrolibException: brut.common.BrutException: could not exec: [C:\
Users\UNIVER~1\AppData\Local\Temp\brut_util_Jar_17611383616886843891.tmp, p, --f
orced-package-id, 1, --min-sdk-version, 28, --target-sdk-version, 28, --version-
code, 28, --version-name, 9, --no-version-vectors, -F, C:\Users\UNIVER~1\AppData
\Local\Temp\APKTOOL4623627588518578316.tmp, -x, -0, arsc, -0, png, -0, res/drawa
ble-hdpi-v4/dialog_middle_holo.9.png, -0, res/drawable-hdpi-v4/divider_strong_ho
lo.9.png, -0, res/drawable-hdpi-v4/jog_tab_bar_left_end_confirm_gray.9.png, -0,
res/drawable-hdpi-v4/jog_tab_bar_left_end_confirm_green.9.png, -0, res/drawable-
hdpi-v4/jog_tab_bar_left_end_confirm_red.9.png, -0, res/drawable-hdpi-v4/jog_tab
_bar_left_end_confirm_yellow.9.png, -0, res/drawable-hdpi-v4/jog_tab_bar_left_en
d_normal.9.png, -0, res/drawable-hdpi-v4/jog_tab_bar_left_end_pressed.9.png, -0,
 res/drawable-hdpi-v4/jog_tab_bar_right_end_confirm_gray.9.png, -0, res/drawable
-hdpi-v4/jog_tab_bar_right_end_confirm_green.9.png, -0, res/drawable-hdpi-v4/jog
_tab_bar_right_end_confirm_red.9.png, -0, res/drawable-hdpi-v4/jog_tab_bar_right
_end_confirm_yellow.9.png, -0, res/drawable-hdpi-v4/jog_tab_bar_right_end_normal
.9.png, -0, res/drawable-hdpi-v4/jog_tab_bar_right_end_pressed.9.png, -0, res/dr
awable-hdpi-v4/sim_dark_blue.9.png, -0, res/drawable-hdpi-v4/sim_dark_green.9.pn
g, -0, res/drawable-hdpi-v4/sim_dark_orange.9.png, -0, res/drawable-hdpi-v4/sim_
dark_purple.9.png, -0, res/drawable-hdpi-v4/sim_light_blue.9.png, -0, res/drawab
le-hdpi-v4/sim_light_green.9.png, -0, res/drawable-hdpi-v4/sim_light_orange.9.pn
g, -0, res/drawable-hdpi-v4/sim_light_purple.9.png, -0, res/drawable-hdpi-v4/tex
tfield_bg_activated_holo_dark.9.png, -0, res/drawable-hdpi-v4/textfield_bg_defau
lt_holo_dark.9.png, -0, res/drawable-hdpi-v4/textfield_bg_disabled_focused_holo_
dark.9.png, -0, res/drawable-hdpi-v4/textfield_bg_disabled_holo_dark.9.png, -0,
res/drawable-hdpi-v4/textfield_bg_focused_holo_dark.9.png, -0, res/drawable-hdpi
-v4/textfield_longpress_holo.9.png, -0, res/drawable-hdpi-v4/textfield_pressed_h
olo.9.png, -0, res/drawable-land-hdpi-v4/jog_tab_bar_left_end_confirm_gray.9.png
, -0, res/drawable-land-hdpi-v4/jog_tab_bar_left_end_confirm_green.9.png, -0, re
s/drawable-land-hdpi-v4/jog_tab_bar_left_end_confirm_red.9.png, -0, res/drawable
-land-hdpi-v4/jog_tab_bar_left_end_confirm_yellow.9.png, -0, res/drawable-land-h
dpi-v4/jog_tab_bar_left_end_normal.9.png, -0, res/drawable-land-hdpi-v4/jog_tab_
bar_left_end_pressed.9.png, -0, res/drawable-land-hdpi-v4/jog_tab_bar_right_end_
confirm_gray.9.png, -0, res/drawable-land-hdpi-v4/jog_tab_bar_right_end_confirm_
green.9.png, -0, res/drawable-land-hdpi-v4/jog_tab_bar_right_end_confirm_red.9.p
ng, -0, res/drawable-land-hdpi-v4/jog_tab_bar_right_end_confirm_yellow.9.png, -0
, res/drawable-land-hdpi-v4/jog_tab_bar_right_end_normal.9.png, -0, res/drawable
-land-hdpi-v4/jog_tab_bar_right_end_pressed.9.png, -0, res/drawable-land-xhdpi-v
4/btn_lock_normal.9.png, -0, res/drawable-nodpi-v4/text_cursor_holo_dark.9.png,
-0, res/drawable-nodpi-v4/text_cursor_holo_light.9.png, -0, res/drawable-xhdpi-v
4/activity_title_bar.9.png, -0, res/drawable-xhdpi-v4/btn_check_label_background
.9.png, -0, res/drawable-xhdpi-v4/btn_default_normal.9.png, -0, res/drawable-xhd
pi-v4/btn_default_normal_disable.9.png, -0, res/drawable-xhdpi-v4/btn_default_no
rmal_disable_focused.9.png, -0, res/drawable-xhdpi-v4/btn_default_pressed.9.png,
 -0, res/drawable-xhdpi-v4/btn_default_selected.9.png, -0, res/drawable-xhdpi-v4
/btn_default_small_normal.9.png, -0, res/drawable-xhdpi-v4/btn_default_small_nor
mal_disable.9.png, -0, res/drawable-xhdpi-v4/btn_default_small_normal_disable_fo
cused.9.png, -0, res/drawable-xhdpi-v4/btn_default_small_pressed.9.png, -0, res/
drawable-xhdpi-v4/btn_default_small_selected.9.png, -0, res/drawable-xhdpi-v4/bt
n_default_transparent_normal.9.png, -0, res/drawable-xhdpi-v4/btn_dropdown_disab
led.9.png, -0, res/drawable-xhdpi-v4/btn_dropdown_disabled_focused.9.png, -0, re
s/drawable-xhdpi-v4/btn_dropdown_normal.9.png, -0, res/drawable-xhdpi-v4/btn_dro
pdown_pressed.9.png, -0, res/drawable-xhdpi-v4/btn_dropdown_selected.9.png, -0,
res/drawable-xhdpi-v4/btn_erase_default.9.png, -0, res/drawable-xhdpi-v4/btn_era
se_pressed.9.png, -0, res/drawable-xhdpi-v4/btn_erase_selected.9.png, -0, res/dr
awable-xhdpi-v4/btn_global_search_normal.9.png, -0, res/drawable-xhdpi-v4/btn_ke
yboard_key_dark_normal_holo.9.png, -0, res/drawable-xhdpi-v4/btn_keyboard_key_da
rk_normal_off_holo.9.png, -0, res/drawable-xhdpi-v4/btn_keyboard_key_dark_normal
_on_holo.9.png, -0, res/drawable-xhdpi-v4/btn_keyboard_key_dark_pressed_holo.9.p
ng, -0, res/drawable-xhdpi-v4/btn_keyboard_key_dark_pressed_off_holo.9.png, -0,
res/drawable-xhdpi-v4/btn_keyboard_key_dark_pressed_on_holo.9.png, -0, res/drawa
ble-xhdpi-v4/btn_keyboard_key_fulltrans_normal.9.png, -0, res/drawable-xhdpi-v4/
btn_keyboard_key_fulltrans_normal_off.9.png, -0, res/drawable-xhdpi-v4/btn_keybo
ard_key_fulltrans_normal_on.9.png, -0, res/drawable-xhdpi-v4/btn_keyboard_key_fu
lltrans_pressed.9.png, -0, res/drawable-xhdpi-v4/btn_keyboard_key_fulltrans_pres
sed_off.9.png, -0, res/drawable-xhdpi-v4/btn_keyboard_key_fulltrans_pressed_on.9
.png, -0, res/drawable-xhdpi-v4/btn_keyboard_key_light_normal_holo.9.png, -0, re
s/drawable-xhdpi-v4/btn_keyboard_key_light_pressed_holo.9.png, -0, res/drawable-
xhdpi-v4/btn_keyboard_key_normal.9.png, -0, res/drawable-xhdpi-v4/btn_keyboard_k
ey_normal_off.9.png, -0, res/drawable-xhdpi-v4/btn_keyboard_key_normal_on.9.png,
 -0, res/drawable-xhdpi-v4/btn_keyboard_key_pressed.9.png, -0, res/drawable-xhdp
i-v4/btn_keyboard_key_pressed_off.9.png, -0, res/drawable-xhdpi-v4/btn_keyboard_
key_pressed_on.9.png, -0, res/drawable-xhdpi-v4/btn_keyboard_key_trans_normal.9.
png, -0, res/drawable-xhdpi-v4/btn_keyboard_key_trans_normal_off.9.png, -0, res/
drawable-xhdpi-v4/btn_keyboard_key_trans_normal_on.9.png, -0, res/drawable-xhdpi
-v4/btn_keyboard_key_trans_pressed.9.png, -0, res/drawable-xhdpi-v4/btn_keyboard
_key_trans_pressed_off.9.png, -0, res/drawable-xhdpi-v4/btn_keyboard_key_trans_p
ressed_on.9.png, -0, res/drawable-xhdpi-v4/btn_keyboard_key_trans_selected.9.png
, -0, res/drawable-xhdpi-v4/btn_media_player.9.png, -0, res/drawable-xhdpi-v4/bt
n_media_player_disabled.9.png, -0, res/drawable-xhdpi-v4/btn_media_player_disabl
ed_selected.9.png, -0, res/drawable-xhdpi-v4/btn_media_player_pressed.9.png, -0,

                                                      .     .     .
                        (reduced the size because it's not really useful)

wable-xxhdpi-v4/textfield_search_right_selected_holo_light.9.png, -0, res/drawab
le-xxhdpi-v4/textfield_search_selected_holo_dark.9.png, -0, res/drawable-xxhdpi-
v4/textfield_search_selected_holo_light.9.png, -0, res/drawable-xxhdpi-v4/transp
ortcontrol_bg.9.png, -0, ogg, -0, arsc, -S, C:\Users\universite\Desktop\Andrew\A
mbiantDisplay\framework-res\res, -M, C:\Users\universite\Desktop\Andrew\AmbiantD
isplay\framework-res\AndroidManifest.xml]

–> Full log: https://pastebin.com/tRZUVCe3

Steps to Reproduce

  1. -apktool d framework-res.apk -apktool b framework-res (to have the looooong stacktrace)

  2. -apktool d framework-res.apk -apktool b --use-aapt2 framework-res (to have the shorter and more explicite stacktrace)

Frameworks

This framework-res.apk (that I try to decompile) is from a ROM (Evolution X 2.0) , I did install it with the command “apktool if framework-res.apk”. I also installed the SystemUI.apk using “apktool if SystemUI.apk”.

APKs

I don’t know if those can be shared freely (I think so tho, since it’s out of an open source ROM) Here you go:

Framework-res and SystemUI.zip

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything? That what I’m doing in order to have this issue.
  2. If you are trying to install a modified apk, did you resign it? No, I’m not trying to install it (since I can’t recompile it).
  3. Are you using the latest apktool version? I used both 2.4.0 and 2.3.2 but I got the same output from both, so I chosed to pick the 2.3.2 version.

Important Note:

I know that this issue has been reported a lot already, it looks like (in my case) this issue occurs with framework-res.apk files. But you’ll see in the details that it’s not only my case, so I made a really detailed bug description in order to fix the problem or to report it properly once for all (don’t mean to represent every single bug of this kind, but a kind of at the same time).

List of similar issues with dummy values

-#252 -#2095 -#1773

Details, Please Read

So, this is a long story. I used to decompile framework-res.apk (from LOS Nougat) from multiple ROMs 1 year ago using my Ubuntu desktop. It worked perfectly at that time, but I don’t remember which version of apktool I was using (maybe 2.2.4). Since them I didn’t used apktool for about a solid 10 months, and one month ago I decided to theme the framework-res.apk of a ROM to enable Ambiant Display Gestures on it. I installed the framework-res.apk as well as the SystemUI.apk using apktool if ... commands. I’m used apktool 2.4.0. I first decompiled the apk with apktool d framework-res.apk, modified it and tried to recompile it (apktool b framework-res.apk -c). It didn’t worked.

Then I just decompiled/recompiled the apk with the -c mark. Still Didn’t wanted to work. I decided to check if java was set the wrong way, but everything was correct on this side. So, java isn’t the problem. Then I tried to decompile/recompile with aapt2: apktool b --use-aapt2 framework-res The output and the duration of the recompiling process were different, but still an error. At least I had something to start with: the stacktrace pointed me some lines at the end of the attrs.xml file. So I headed to the lines and I saw this <item type="attr" name="APKTOOL_DUMMY_428">false</item>. I googled “apktool dummy” and I found the apktool bugtracker with other issues related to those “apktool dummy” things. I learnt that APKTOOL_DUMMY_… were the names given to unread values, values that apktool can’t read, most of the time because the apk file was corrupted.

But I knew to that my framework-res.apk file wasn’t corrupted because it ran without any problems on the ROM I use. Then I tryed to decompile/recompile a third party app (XDA Labs) but no problem this time. I tried then to decompile the framework-res.apk file that I used to decompile when I was on Linux (the LOS Nougat one) but same error: APKTOOL_DUMMY_… at the exact same lines that in the framework-res.apk file from Android Pie.

So I thought apktool 2.4.0 was buggy, and I tried with apktool 2.3.2 but same results (as you can see). So I then tested with apktool 2.2.4 and this time , dummy values weren’t located at the same place, but still there. BBUUTT apktool 2.2.4 managed somehow to recompile it.

Soooo, I thought the problem was comming from my PC, that’s why I asked to a recognized contributor from xda (tulsadiver) to do it for me : https://forum.xda-developers.com/showpost.php?p=79706547&postcount=7755 In the decompressed apk he gave me, those dummy values were still here at the same place.

As a consequence I couldn’t recompile the folder. My last attemp before posting here was to remove the dummy values knowing that those values are here to fill the whole left by untrancripted values. It didn’t worked too, that why I’m here. If you have even any clues on what I could do, or if the problem is really related to apktool, please let me know down below.

(Update:21-12-2020)This issue is finaly solved!

I made a comment explaining it, here it is: https://github.com/iBotPeaches/Apktool/issues/2104#issuecomment-748979269 . To make it short the issue was fixed in apktool v2.5.0, I still ran into some errors regarding dummy values, but they’re easy to solve. This works using aapt1

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
Hax4uscommented, Sep 24, 2019

Same issue @iBotPeaches

3reactions
RaiZProductioncommented, Dec 21, 2020

This issue is finally fixed, and the fix merged, thanks to iBotPeaches. Issue #2439 explains it all. I tested it today using apktool v2.5.0 on the framework-res file above. The style.xml file contained some double lines that caused a bit of trouble. The trouble:

W: /Users/Raiz/Desktop/apktool/framework-res/res/values/styles.xml:1185: error: Resource entry Theme.Holo already has bag item textEditSuggestionItemLayout.
W: /Users/Raiz/Desktop/apktool/framework-res/res/values/styles.xml:1184: Originally defined here.
W: 
W: /Users/Raiz/Desktop/apktool/framework-res/res/values/styles.xml:1262: error: Resource entry Theme.Holo already has bag item preferenceFrameLayoutStyle.
W: /Users/Raiz/Desktop/apktool/framework-res/res/values/styles.xml:1261: Originally defined here.
W: 
W: /Users/Raiz/Desktop/apktool/framework-res/res/values/styles.xml:1271: error: Resource entry Theme.Holo already has bag item textEditSuggestionContainerLayout.
W: /Users/Raiz/Desktop/apktool/framework-res/res/values/styles.xml:1270: Originally defined here.
W: 
W: /Users/Raiz/Desktop/apktool/framework-res/res/values/styles.xml:1273: error: Resource entry Theme.Holo already has bag item textEditSuggestionHighlightStyle.
W: /Users/Raiz/Desktop/apktool/framework-res/res/values/styles.xml:1272: Originally defined here.

Once corrected, I faced another issue regarding one dummy value. The dummy value:

<dimen name="APKTOOL_DUMMY_15e" />

The issue:

/Users/Raiz/Desktop/apktool/framework-res/res/values/dimens.xml:464: error: Error: String types not allowed (at 'APKTOOL_DUMMY_15e' with value '').

As said in issue #2439, the fix is to “set dummy attributes to same type (@null)” So I manually modified the line to:

<dimen name="APKTOOL_DUMMY_15e">@null</dimen> 

I recompiled the apk without any issue, so in short, apktool v2.5.0 fixed the dummy value “bug”, and if you run into another error like mine, the solution is to modify it manually and set a value to is (@null)

I used the default aapt to do that (aapt1), I got errors using aapt2. This is explained in issue #2438.

I’ll leave this issue opened if I run into other issues regarding dummy values, but I consider this issue for the major part solved by apktool 2.5.0. Have a good day everybody 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

[UTIL][NOV 24, 2022] Apktool - Tool for reverse engineering ...
Need help. I tried to mod systemui.apk according to this Method i just replace some png's like wifi,bluetooth and signal bars etc, ...
Read more >
Apktool - Changelog
Apktool - Changelog / Roadmap. ... Add apktool-cli to Maven publishing. ... Simply creates dummy key value names to prevent duplicate resource error....
Read more >
How to avoid reverse engineering of an APK file
1. How can I completely avoid reverse engineering of an Android APK? Is this possible? AFAIK, there is not any trick for complete...
Read more >
Apktool v2.6.0 Released - Connor Tumbleson
Apktool v2.6.0 has been released! This is a long overdue release that fixes many issues and packs a few new features/behavior in.
Read more >
Patching Android Split APKs - NickstaDB
The dummy resource names generated by apktool aren't a problem in many cases because Android apps tend to refer to resources by their...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found