Skip to content
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]Issues repacking res it gives issues with apktool_dummy in integers.xml and dimens.xml #2462

Closed
sac23 opened this issue Dec 4, 2020 · 19 comments

Comments

@sac23
Copy link

sac23 commented Dec 4, 2020

Information

Apktool 2.5.1-145201-SNAPSHOT

Stacktrace/Logcat

Include stacktrace here
I: Using Apktool 2.5.1-145201-SNAPSHOT
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
W: warning: string 'wfcSpnFormat' has no default translation.
W: Failed to generate resource table for split ''
W: C:\Users\Sac23\Desktop\hhh\framework-res\res\values\integers.xml:361: error: Error: String types not allowed (at 'APKTOOL_DUMMY_72' with value '').
W:
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\Sac23\AppData\Local\Temp\brut_util_Jar_64426037738495893106265858736697657594.tmp, p, --forced-package-id, 1, --min-sdk-version, 29, --target-sdk-version, 29, --version-code, 29, --version-name, 10, --no-version-vectors, -F, C:\Users\Sac23\AppData\Local\Temp\APKTOOL9077465573776423434.tmp, -x, -e, C:\Users\Sac23\AppData\Local\Temp\APKTOOL5862047175049083314.tmp, -0, arsc, -S, C:\Users\Sac23\Desktop\hhh\framework-res\res, -M, C:\Users\Sac23\Desktop\hhh\framework-res\AndroidManifest.xml]

Steps to Reproduce

apktool d framework-res.apk
apktool b framework-res

Frameworks

samsung framework-res,apk

APK

framework-res.zip

Questions to ask before submission

im having issues repacking res it gives issues with apktool_dummy
in integers.xml and dimens.xml

@sac23 sac23 changed the title [BUG] [BUG]Issues repacking res it gives issues with apktool_dummy in integers.xml and dimens.xml Dec 4, 2020
@iBotPeaches
Copy link
Owner

I got a different crash, then tried 2 and got something else.

aapt2

W: brut_util_Jar_3092712356914815515190864867650699858.tmp F 12-04 06:04:19  9546  9546 PrivateAttributeMover.cpp:84] Check failed: priv_attr_type->entries.empty() 
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 134): [/tmp/brut_util_Jar_3092712356914815515190864867650699858.tmp, link, -o, /tmp/APKTOOL8933757585618793637.tmp, --package-id, 1, --min-sdk-version, 29, --target-sdk-version, 29, --version-code, 29, --version-name, 10, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, -x, -e, /tmp/APKTOOL2080178795101919544.tmp, -0, arsc, --manifest, /home/ibotpeaches/Downloads/Apktool/2462/framework-res/AndroidManifest.xml, /home/ibotpeaches/Downloads/Apktool/2462/framework-res/build/resources.zip]
➜  2462 

aapt1

➜  2462 apktool b framework-res  
I: Using Apktool 2.5.1-d1c006-SNAPSHOT
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
W: /home/ibotpeaches/Downloads/Apktool/2462/framework-res/res/values/styles.xml:1253: error: Resource entry Theme.Holo already has bag item textEditSuggestionItemLayout.
W: /home/ibotpeaches/Downloads/Apktool/2462/framework-res/res/values/styles.xml:1252: Originally defined here.

Not sure yet.

@edzamber
Copy link

edzamber commented Dec 4, 2020

Many Dummy files are created when decompil/recompil in dimens, strings and integers. Style dobles are normals, just remove it from styles and done.

But for Dummy files lines, its crazy, there are Many, maybe more than 100 and also created in public.xml

Here some of theses :

W: C:\Users\admin\Desktop\TickleMyAndroid_WorkArea2_working\framework-res.apk\res\values\dimens.xml:1343: error: Error: String types not allowed (at 'APKTOOL_DUMMY_242' with value '').
W: C:\Users\admin\Desktop\TickleMyAndroid_WorkArea2_working\framework-res.apk\res\values\integers.xml:361: error: Error: String types not allowed (at 'APKTOOL_DUMMY_22' with value '').
<public type="attr" name="APKTOOL_DUMMY_267" id="0x01010267"
<public type="attr" name="APKTOOL_DUMMY_3a8" id="0x010103a8"
<public type="attr" name="APKTOOL_DUMMY_3c3" id="0x010103c3"
<public type="attr" name="APKTOOL_DUMMY_40e" id="0x0101040e"

<public type="attr" name="APKTOOL_DUMMY_5f1" id="0x010105f1"
<public type="attr" name="APKTOOL_DUMMY_5f2" id="0x010105f2"
<public type="attr" name="APKTOOL_DUMMY_5f3" id="0x010105f3"
<public type="attr" name="APKTOOL_DUMMY_5f4" id="0x010105f4"
<public type="attr" name="APKTOOL_DUMMY_5f5" id="0x010105f5"
<public type="attr" name="APKTOOL_DUMMY_5f6" id="0x010105f6"
<public type="attr" name="APKTOOL_DUMMY_5f7" id="0x010105f7"
<public type="attr" name="APKTOOL_DUMMY_5f8" id="0x010105f8"
<public type="attr" name="APKTOOL_DUMMY_5f9" id="0x010105f9"
<public type="attr" name="APKTOOL_DUMMY_5fa" id="0x010105fa"
<public type="attr" name="APKTOOL_DUMMY_5fb" id="0x010105fb"
<public type="attr" name="APKTOOL_DUMMY_5fc" id="0x010105fc"
<public type="attr" name="APKTOOL_DUMMY_5fd" id="0x010105fd"
<public type="attr" name="APKTOOL_DUMMY_5fe" id="0x010105fe"
<public type="attr" name="APKTOOL_DUMMY_5ff" id="0x010105ff"
<public type="string" name="APKTOOL_DUMMY_209" id="0x01040209"
<public type="string" name="APKTOOL_DUMMY_641" id="0x01040641"
<public type="string" name="APKTOOL_DUMMY_a10" id="0x01040a10"
<public type="string" name="APKTOOL_DUMMY_c86" id="0x01040c86"
<public type="string" name="APKTOOL_DUMMY_c88" id="0x01040c88"
<public type="string" name="APKTOOL_DUMMY_ce8" id="0x01040ce8"
<public type="string" name="APKTOOL_DUMMY_ce9" id="0x01040ce9"
<public type="string" name="APKTOOL_DUMMY_cea" id="0x01040cea"
<public type="string" name="APKTOOL_DUMMY_ceb" id="0x01040ceb"
<public type="string" name="APKTOOL_DUMMY_cec" id="0x01040cec"
<public type="string" name="APKTOOL_DUMMY_ced" id="0x01040ced"
<public type="integer" name="APKTOOL_DUMMY_22" id="0x010e0022"
<public type="integer" name="APKTOOL_DUMMY_72" id="0x010e0072"
<public type="integer" name="APKTOOL_DUMMY_73" id="0x010e0073"
<public type="integer" name="APKTOOL_DUMMY_74" id="0x010e0074"
<public type="integer" name="APKTOOL_DUMMY_75" id="0x010e0075"
<public type="integer" name="APKTOOL_DUMMY_76" id="0x010e0076"
<public type="integer" name="APKTOOL_DUMMY_77" id="0x010e0077"
<public type="integer" name="APKTOOL_DUMMY_78" id="0x010e0078"
<public type="integer" name="APKTOOL_DUMMY_79" id="0x010e0079"
<public type="integer" name="APKTOOL_DUMMY_7a" id="0x010e007a"
<public type="integer" name="APKTOOL_DUMMY_7b" id="0x010e007b"
<public type="integer" name="APKTOOL_DUMMY_7c" id="0x010e007c"
<public type="integer" name="APKTOOL_DUMMY_7d" id="0x010e007d"
<public type="integer" name="APKTOOL_DUMMY_ab" id="0x010e00ab"
<public type="integer" name="APKTOOL_DUMMY_dd" id="0x010e00dd"
<integer name="APKTOOL_DUMMY_7c"
<integer name="APKTOOL_DUMMY_7d"
<integer name="APKTOOL_DUMMY_ab
<integer name="APKTOOL_DUMMY_dd"

@Phone-Guru
Copy link

This issue started for me after a commit which changed how dummy attributes were produced, this one I think,
1422293

@iBotPeaches
Copy link
Owner

This issue started for me after a commit which changed how dummy attributes were produced, this one I think,
1422293

This is intentional and I don't think I'll be reverting this. This is a much better approach than previous and falls in line with aapt2 restrictions.

@betaxab
Copy link

betaxab commented Jan 7, 2021

I have some similar errors:

I: Building resources...
W: D:\apk\res\values\anims.xml:30: error: Found tag anim where item is expected
W:
W: D:\apk\res\values\ids.xml:415: error: Found tag id where item is expected
W:
W: D:\apk\res\values\layouts.xml:137: error: Found tag layout where item is expected

anims.xml:30 is:
<anim name="APKTOOL_DUMMY_18" />

ids.xml:415 is:

<id name="APKTOOL_DUMMY_4" />

layouts.xml:137 is:

<layout name="APKTOOL_DUMMY_24" />

@Krowne
Copy link

Krowne commented Jan 17, 2021

I have some similar errors:

I: Building resources...
W: D:\apk\res\values\anims.xml:30: error: Found tag anim where item is expected
W:
W: D:\apk\res\values\ids.xml:415: error: Found tag id where item is expected
W:
W: D:\apk\res\values\layouts.xml:137: error: Found tag layout where item is expected

anims.xml:30 is:
<anim name="APKTOOL_DUMMY_18" />

ids.xml:415 is:

<id name="APKTOOL_DUMMY_4" />

layouts.xml:137 is:

<layout name="APKTOOL_DUMMY_24" />

The problem is that it doesn't assign the elements as item type. Just add the elements in the correct syntax and it will work.

<anim name="APKTOOL_DUMMY_18" /> to <item type="anim" name="APKTOOL_DUMMY_18" />

<id name="APKTOOL_DUMMY_4" /> to <item type="id" name="APKTOOL_DUMMY_4" />

and

<layout name="APKTOOL_DUMMY_24" /> to <item type="layout" name="APKTOOL_DUMMY_24" />

And with any other resource file you have to do the same. Since it will surely not solve this, I am creating a program for my own use that detects and modifies these values automatically when I finish decompiling.

@AndnixSH
Copy link

I have the same problem with this APK https://apkcombo.com/apk-downloader/?arches=armeabi-v7a&q=com.snailgameusa.aowd

I: Using Apktool 2.5.0
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
I: Checking whether resources has changed...
I: Building resources...
W: C:\Users\xxxxx\temp\Decompiled\res\values\layouts.xml:3: error: Found tag layout where item is expected
W: 
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\bbeb\AppData\Local\Temp\brut_util_Jar_55542029603479449803030860669184764945.tmp, p, --forced-package-id, 127, --min-sdk-version, 17, --target-sdk-version, 29, --version-code, 230, --version-name, 23.0.0, --no-version-vectors, -F, C:\Users\bbeb\AppData\Local\Temp\APKTOOL1324230165080781216.tmp, -e, C:\Users\bbeb\AppData\Local\Temp\APKTOOL7033925294973435639.tmp, -0, arsc, -I, C:\Users\bbeb\AppData\Local\apktool\framework\1.apk, -S, C:\Users\xxxxx\temp\Decompiled\res, -M, C:\Users\xxxxx\temp\Decompiled\AndroidManifest.xml]

@enovella
Copy link

In the same manner #2501

[16:38 edu@xps tmp] >  apktool b com.wireguard.android
I: Using Apktool 2.5.0
I: Copying com.wireguard.android classes.dex file...
I: Copying com.wireguard.android classes2.dex file...
I: Checking whether resources has changed...
I: Building resources...
W: Failed to generate resource table for split ''
W: /tmp/com.wireguard.android/res/values/drawables.xml:7: error: Error: String types not allowed (at 'APKTOOL_DUMMY_b' with value '').
W: 
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_137844021837667621165916702805564322097.tmp, p, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 30, --version-code, 485, --version-name, 1.0.20201224, --no-version-vectors, -F, /tmp/APKTOOL251826602113890625.tmp, -e, /tmp/APKTOOL17608074881270986798.tmp, -0, arsc, -I, /home/edu/.local/share/apktool/framework/1.apk, -S, /tmp/com.wireguard.android/res, -M, /tmp/com.wireguard.android/AndroidManifest.xml]

@AndnixSH
Copy link

Alright, in my case, I fixed it by removing

<layout name="APKTOOL_DUMMY_3a" />
<layout name="APKTOOL_DUMMY_5a" />

From \res\values\layouts.xml

And also removing

<public type="layout" name="APKTOOL_DUMMY_3a" id="0x7f09003a" />
<public type="layout" name="APKTOOL_DUMMY_5a" id="0x7f09005a" />

From res\values\public.xml

Compiled successfully and the game is working fine so far

@AndnixSH
Copy link

AndnixSH commented Mar 16, 2021

I found the fastest way to remove all APKTOOL_DUMMY in few clicks. The game i encounted, had a thousands of APKTOOL_DUMMY in/res/values/. So I use notepad++ and do regex search and replace all though /res/values/ removing lines

^.*(APKTOOL_DUMMY).*$

This regex match a whole line containing APKTOOL_DUMMY

image

There are of course a possibility it may break something. Games with removed APKTOOL_DUMMY have been working fine for me so far

Before:

I: Using Apktool 2.5.0
I: Smaling smali folder into classes.dex...
I: Building resources...
W: D:\APK Easy Tool\1-Decompiled APKs\_com,bilibili,gcg2,aligames_1,1,28\res\values\ids.xml:64: error: Found tag id where item is expected
W: 
W: D:\APK Easy Tool\1-Decompiled APKs\_com,bilibili,gcg2,aligames_1,1,28\res\values\layouts.xml:3: error: Found tag layout where item is expected
W: 

After:

I: Using Apktool 2.5.0
I: Smaling smali folder into classes.dex...
I: Building resources...
I: Copying libs... (/lib)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk...

@edzamber
Copy link

I found the fastest way to remove all APKTOOL_DUMMY in few clicks. The game i encounted, had a thousands of APKTOOL_DUMMY in/res/values/. So I use notepad++ and do regex search and replace all though /res/values/ removing lines

^.*(APKTOOL_DUMMY).*$

This regex match a whole line containing APKTOOL_DUMMY

image

There are of course a possibility it may break something. Games with removed APKTOOL_DUMMY have been working fine for me so far

Before:

I: Using Apktool 2.5.0
I: Smaling smali folder into classes.dex...
I: Building resources...
W: D:\APK Easy Tool\1-Decompiled APKs\_com,bilibili,gcg2,aligames_1,1,28\res\values\ids.xml:64: error: Found tag id where item is expected
W: 
W: D:\APK Easy Tool\1-Decompiled APKs\_com,bilibili,gcg2,aligames_1,1,28\res\values\layouts.xml:3: error: Found tag layout where item is expected
W: 

After:

I: Using Apktool 2.5.0
I: Smaling smali folder into classes.dex...
I: Building resources...
I: Copying libs... (/lib)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk...

Wow it working perfectly on framework-res.apk Oneui 3.1 for S20 G98x !

Well done !

@dlaraf
Copy link

dlaraf commented Mar 19, 2021

sometimes using option --use-aapt2 will do the trick

@stdNullPtr
Copy link

stdNullPtr commented Mar 23, 2021

From logcat output I get
03-23 18:25:10.312 930 930 E ResourcesManager: failed to add split asset path /data/app/com.withbuddies.diceellen-1/split_config.armeabi_v7a.apk 03-23 18:25:10.312 930 930 E ResourcesManager: failed to add split asset path /data/app/com.withbuddies.diceellen-1/split_config.armeabi_v7a.apk 03-23 18:25:10.312 930 930 E ResourcesManager: failed to add split asset path /data/app/com.withbuddies.diceellen-1/split_config.armeabi_v7a.apk 03-23 18:25:10.312 930 930 E ResourcesManager: failed to add split asset path /data/app/com.withbuddies.diceellen-1/split_config.armeabi_v7a.apk 03-23 18:25:10.312 930 930 E ResourcesManager: failed to add split asset path /data/app/com.withbuddies.diceellen-1/split_config.armeabi_v7a.apk 03-23 18:25:10.312 930 930 E ResourcesManager: failed to add split asset path /data/app/com.withbuddies.diceellen-1/split_config.armeabi_v7a.apk

After recompiling the app with @Krowne 's solution, and it doesn't start.

I noticed that these issues happen when the apk was split files - for example:

INFO: Executing command: adb shell pm path com.withbuddies.diceellen package:/data/app/com.withbuddies.diceellen-1/base.apk package:/data/app/com.withbuddies.diceellen-1/split_config.armeabi_v7a.apk package:/data/app/com.withbuddies.diceellen-1/split_config.en.apk package:/data/app/com.withbuddies.diceellen-1/split_config.hdpi.apk

Maybe I am just not decompilig/recompilig correctly in that case?
Can someone enlighten me on how we proceed with split apks?

@AndnixSH
Copy link

@Xaxoxuxu you can get single APK from Apkcombo to save your time. No need to deal with split APK https://apkcombo.com/en-dk/apk-downloader/?device=&arches=&sdkInt=&sa=1&lang=en&dpi=480&q=com.withbuddies.diceellen

Apkcombo is safe and i have been using it since it was born

@Krowne
Copy link

Krowne commented Mar 27, 2021

From logcat output I get
03-23 18:25:10.312 930 930 E ResourcesManager: failed to add split asset path /data/app/com.withbuddies.diceellen-1/split_config.armeabi_v7a.apk 03-23 18:25:10.312 930 930 E ResourcesManager: failed to add split asset path /data/app/com.withbuddies.diceellen-1/split_config.armeabi_v7a.apk 03-23 18:25:10.312 930 930 E ResourcesManager: failed to add split asset path /data/app/com.withbuddies.diceellen-1/split_config.armeabi_v7a.apk 03-23 18:25:10.312 930 930 E ResourcesManager: failed to add split asset path /data/app/com.withbuddies.diceellen-1/split_config.armeabi_v7a.apk 03-23 18:25:10.312 930 930 E ResourcesManager: failed to add split asset path /data/app/com.withbuddies.diceellen-1/split_config.armeabi_v7a.apk 03-23 18:25:10.312 930 930 E ResourcesManager: failed to add split asset path /data/app/com.withbuddies.diceellen-1/split_config.armeabi_v7a.apk

After recompiling the app with @Krowne 's solution, and it doesn't start.

I noticed that these issues happen when the apk was split files - for example:

INFO: Executing command: adb shell pm path com.withbuddies.diceellen package:/data/app/com.withbuddies.diceellen-1/base.apk package:/data/app/com.withbuddies.diceellen-1/split_config.armeabi_v7a.apk package:/data/app/com.withbuddies.diceellen-1/split_config.en.apk package:/data/app/com.withbuddies.diceellen-1/split_config.hdpi.apk

Maybe I am just not decompilig/recompilig correctly in that case?
Can someone enlighten me on how we proceed with split apks?

Your error doesn't seem to be in the resources folder but in the assets folder. My solution was for when can't compile due to resources, fixing it. However, I am going to add a script that I am currently using to modify all the strings containing the problems mentioned above without using external programs. Note that this does not fix issues with asset and apps splits.

You have to put the file in the root folder of the project (where AndroidManifest.xml is located).

@echo off
cd res
call :limp anims.xml anim
call :limp drawables.xml drawable
call :limp ids.xml id
call :limp layouts.xml layout
call :limp mipmaps.xml mipmap
cd..
pause 
exit

:limp vFile vChange
@FOR /f "delims=" %%f IN ('dir /b /s "%1" 2^>nul') DO (
	set /a "idx+=1" 
	set "FilePath[!idx!]=%%~dpFf"
)
if errorlevel 1 goto theend

for /L %%i in (1,1,%idx%) do (
	IF EXIST "!FilePath[%%i]!" ( 
		powershell -Command "(gc !FilePath[%%i]!) -replace '<%2 ', '<item type=\"%2\" ' | Out-File -encoding ASCII !FilePath[%%i]!")
	)
)
:theend
exit /b

This script is for cmd on Windows, if someone knows they can adapt it for Linux.

Note: This script checks all the resource folders that contain the files with the mentioned strings, and appends the missing type content to each line of each file.

@mateusmelodn
Copy link

I've exported the .apk from the files (using the native support from SO) without using any tool. It did exported the .apk but the .apk didn't install at all. In my case "APKTOOL_DUMMY" also appeared. I realized just after reading @AndnixSH's answer. So I used the apkcombo in order to export the .apk and it did work properly.

@ghost
Copy link

ghost commented Aug 8, 2021

I have some similar errors:

I: Building resources...
W: D:\apk\res\values\anims.xml:30: error: Found tag anim where item is expected
W:
W: D:\apk\res\values\ids.xml:415: error: Found tag id where item is expected
W:
W: D:\apk\res\values\layouts.xml:137: error: Found tag layout where item is expected

anims.xml:30 is:
<anim name="APKTOOL_DUMMY_18" />
ids.xml:415 is:
<id name="APKTOOL_DUMMY_4" />
layouts.xml:137 is:
<layout name="APKTOOL_DUMMY_24" />

The problem is that it doesn't assign the elements as item type. Just add the elements in the correct syntax and it will work.

<anim name="APKTOOL_DUMMY_18" /> to <item type="anim" name="APKTOOL_DUMMY_18" />

<id name="APKTOOL_DUMMY_4" /> to <item type="id" name="APKTOOL_DUMMY_4" />

and

<layout name="APKTOOL_DUMMY_24" /> to <item type="layout" name="APKTOOL_DUMMY_24" />

And with any other resource file you have to do the same. Since it will surely not solve this, I am creating a program for my own use that detects and modifies these values automatically when I finish decompiling.

This worked for me

@edzamber
Copy link

Bug fixed with latests commits.

Now working (decompil and recompil).

I used apktool-2.5.1-caee50-SNAPSHOT-small

photo_2021-08-29_16-11-42

@iBotPeaches
Copy link
Owner

Looking at this ticket again. It was originally opened because the change of DUMMY attribute generation had a negative affect for aapt1. This was intentional as the alternative was breaking aapt2.

Since aapt1 is on the way out - this was kept.

The next item is the discussion of DUMMY attributes in general, which some folks are asking should be able to be removed in entirety - that is being tracked here: #2683 so with that. I'm going to close this as I believe nothing left actionable that isn't already covered in this ticket.

@iBotPeaches iBotPeaches closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.