APKTOOL_DUMMY: An obstacle and challenge for apktool users
- litttangershealtht
- Aug 5, 2023
- 8 min read
What is APKTOOL_DUMMY and how to fix it?
If you are an Android developer or modder, you may have encountered a problem when trying to decompile and recompile an APK file using Apktool. Sometimes, you may see some strange values in the XML files, such as APKTOOL_DUMMY_, followed by some numbers or letters. What are these values and why do they appear? How can you fix them and make your APK work properly? In this article, we will answer these questions and show you two methods to solve the APKTOOL_DUMMY issue.
apktool_dummy
Introduction
Apktool is a popular tool for reverse engineering Android applications. It allows you to decode, modify, and rebuild an APK file, which is a compressed package that contains all the resources and code of an app. Apktool can be useful for various purposes, such as customizing an app's appearance, changing its functionality, removing ads or permissions, etc.
However, Apktool is not perfect and sometimes it may fail to decode some of the information in the original APK. This can happen especially when dealing with split APKs, which are a way of distributing apps that have multiple components, such as base, config, feature, or dynamic modules. Split APKs can reduce the download size and optimize the performance of an app, but they can also cause problems for Apktool.
What is APKTOOL_DUMMY?
APKTOOL_DUMMY is a placeholder value that Apktool creates when it cannot decode some of the resources in an APK file. It usually appears in the public.xml file, which is a file that defines all the resource IDs and names in an app. For example, you may see something like this:
<public type="drawable" name="APKTOOL_DUMMY_0" id="0x7f070000" /> <public type="drawable" name="APKTOOL_DUMMY_1" id="0x7f070001" /> <public type="drawable" name="APKTOOL_DUMMY_2" id="0x7f070002" />
This means that Apktool could not find the real names of these drawables, so it assigned them dummy names and IDs. You may also see APKTOOL_DUMMY values in other XML files, such as styles.xml, drawables.xml, etc.
Why does APKTOOL_DUMMY occur?
The main reason why APKTOOL_DUMMY occurs is because Apktool cannot handle split APKs properly. Split APKs have different components that are stored in separate files, such as base.apk, config.xxxhdpi.apk, feature.xxx.apk, etc. Each component has its own resources and code, but they share some common information, such as resource IDs and names.
When Apktool tries to decompile a split APK, it may not be able to find all the information it needs in the base APK. It may also get confused by the presence of the android:isSplitRequired="true" attribute in the AndroidManifest.xml file, which tells the system that the app requires a split APK to run. As a result, Apktool may generate APKTOOL_DUMMY values instead of the real resource names.
How to fix APKTOOL_DUMMY errors?
If you want to recompile and install an APK file that has APKTOOL_DUMMY values, you need to fix them first. Otherwise, your app may not work properly or even crash. There are two main methods to fix APKTOOL_DUMMY errors: one is to manually replace them with real values, and the other is to use a script that automates the process. We will explain both methods in detail below.
apktool_dummy error
apktool_dummy fix
apktool_dummy remove
apktool_dummy values
apktool_dummy drawable
apktool_dummy integer
apktool_dummy dimen
apktool_dummy string
apktool_dummy xml
apktool_dummy public
apktool_dummy id
apktool_dummy name
apktool_dummy issue
apktool_dummy github
apktool_dummy feature
apktool_dummy solution
apktool_dummy problem
apktool_dummy cause
apktool_dummy explanation
apktool_dummy meaning
apktool_dummy decode
apktool_dummy compile
apktool_dummy recompile
apktool_dummy repack
apktool_dummy split
apktool_dummy merge
apktool_dummy script
apktool_dummy code
apktool_dummy chunk
apktool_dummy space
apktool_dummy weight
apktool_dummy delete
apktool_dummy comment
apktool_dummy edit
apktool_dummy replace
apktool_dummy search
apktool_dummy example
apktool_dummy tutorial
apktool_dummy guide
apktool_dummy andnixsh
apktool_dummy ibotpeaches
apktool_dummy renaudcerrato
apktool_dummy pashamcr
apktool dummy androidmanifest
apktools dummy application tag
apktol dummy isSplitRequired
apktol dummy styles.xml
apktol dummy drawables.xml
Method 1: Replace APKTOOL_DUMMY with real values
This method involves decompiling all the split APK files, merging them into one folder, replacing the APKTOOL_DUMMY values with real ones, and recompiling the APK. This method requires some manual work and attention, but it gives you more control over the process. Here are the steps to follow:
Step 1: Decompile the APK files
You need to decompile all the split APK files using Apktool. You can use the following command in a terminal or command prompt:
apktool d -f -o output_folder apk_file
This command will decompile the APK file and save the output in a folder named output_folder. You need to repeat this command for each split APK file that you have. For example, if you have three files named base.apk, config.xxxhdpi.apk, and feature.xxx.apk, you need to run these commands:
apktool d -f -o base base.apk apktool d -f -o config config.xxxhdpi.apk apktool d -f -o feature feature.xxx.apk
This will create three folders named base, config, and feature, each containing the decompiled contents of the corresponding APK file.
Step 2: Merge the files except values to the base APK
The next step is to merge all the files from the other split APKs into the base APK folder, except for the values folder. The values folder contains all the XML files that have APKTOOL_DUMMY values, so we will deal with them later. To merge the files, you can use a file manager or a command line tool to copy and paste them. For example, if you are using Windows, you can use these commands:
xcopy /s /y config\*.* base xcopy /s /y feature\*.* base
This will copy all the files from the config and feature folders into the base folder, overwriting any existing files with the same name. You can delete the config and feature folders after this step.
Step 3: Replace APKTOOL_DUMMY with real values in public.xml and other XML files
The most important file to fix is public.xml, which is located in the base\res\values\public.xml. This file contains all the resource IDs and names in an app, and it is where most of the APKTOOL_DUMMY values appear. To fix this file, you need to find out what are the real names of these resources, and replace them accordingly.
To find out the real names of these resources, you can use a tool called [Apk Analyzer], which is a part of Android Studio. Apk Analyzer can show you all the resources in an app, along with their IDs and names. You can use it to open any of the split APK files, such as config.xxxhdpi.apk, and look for the resources that have IDs matching those in public.xml . For example, you may see something like this:
<public type="drawable" name="APKTOOL_DUMMY_0" id="0x7f070000" />
Then, you can use Apk Analyzer to open config.xxxhdpi.apk and look for the drawable with the same ID:
res/drawable-xxxhdpi-v4/ic_launcher_foreground.png Type: PNG ID: 0x7f070000 Name: ic_launcher_foreground
This means that the real name of this drawable is ic_launcher_foreground, and you can replace it in public.xml like this:
<public type="drawable" name="ic_launcher_foreground" id="0x7f070000" />
You need to repeat this process for all the APKTOOL_DUMMY values in public.xml, using Apk Analyzer to find the real names of the resources. You can also use Apk Analyzer to check if there are any other XML files that have APKTOOL_DUMMY values, such as styles.xml, drawables.xml, etc. If there are, you need to replace them with the real names as well.
Step 4: Edit AndroidManifest.xml and delete android:isSplitRequired="true"
The next step is to edit the AndroidManifest.xml file, which is located in the base\AndroidManifest.xml. This file contains all the information about the app, such as its package name, version, permissions, activities, etc. You need to delete the attribute android:isSplitRequired="true" from the tag, which tells the system that the app requires a split APK to run. Since we are merging all the split APKs into one, we don't need this attribute anymore. For example, you may see something like this:
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" android:isSplitRequired="true">
You need to delete the last line and make it look like this:
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme">
Step 5: Recompile and install the APK
The final step is to recompile the APK using Apktool. You can use the following command in a terminal or command prompt:
apktool b -o new.apk base
This command will recompile the contents of the base folder and create a new APK file named new.apk. You can then sign and install this APK on your device using your preferred method. You should be able to run the app without any errors or crashes.
Method 2: Use a script to resolve APKTOOL_DUMMY names across split APK contents
This method involves using a Python script that can automatically resolve the APKTOOL_DUMMY names across all the split APK contents. This method requires less manual work and attention, but it may not work for all cases. Here are the steps to follow:
Step 1: Download and run the script from GitHub
You need to download and run a Python script called [apktool_dummy_fixer.py], which is available on GitHub. You can use the following commands in a terminal or command prompt:
wget python apktool_dummy_fixer.py -i input_folder -o output_folder
This script will take an input folder that contains all the split APK files, such as base.apk, config.xxxhdpi.apk, feature.xxx.apk, etc. and create an output folder that contains a fixed APK file named output.apk. The script will automatically decompile, merge, and recompile the APK files, and resolve the APKTOOL_DUMMY names using a dictionary.
Step 2: Copy the output files to the base APK folder
The next step is to copy the output files from the output folder to the base APK folder. The output files include the output.apk file and a folder named output, which contains the decompiled contents of the fixed APK file. You can use a file manager or a command line tool to copy and paste them. For example, if you are using Windows, you can use these commands:
xcopy /s /y output\*.* base copy output.apk base
This will copy all the files from the output folder and the output.apk file into the base folder, overwriting any existing files with the same name.
Step 3: Recompile and install the APK
The final step is to recompile the APK using Apktool. You can use the following command in a terminal or command prompt:
apktool b -o new.apk base
This command will recompile the contents of the base folder and create a new APK file named new.apk. You can then sign and install this APK on your device using your preferred method. You should be able to run the app without any errors or crashes.
Conclusion
In this article, we have explained what is APKTOOL_DUMMY and how to fix it. We have shown you two methods to solve the APKTOOL_DUMMY issue: one is to manually replace them with real values, and the other is to use a script that automates the process. Both methods have their advantages and disadvantages, so you can choose the one that suits your needs best. We hope that this article has been helpful for you and that you have learned something new.
FAQs
Here are some frequently asked questions about APKTOOL_DUMMY:
What is Apktool?
Apktool is a popular tool for reverse engineering Android applications. It allows you to decode, modify, and rebuild an APK file, which is a compressed package that contains all the resources and code of an app.
What is a split APK?
A split APK is a way of distributing apps that have multiple components, such as base, config, feature, or dynamic modules. Split APKs can reduce the download size and optimize the performance of an app, but they can also cause problems for Apktool.
What causes APKTOOL_DUMMY?
APKTOOL_DUMMY is a placeholder value that Apktool creates when it cannot decode some of the resources in an APK file. It usually occurs when dealing with split APKs, which have different components that are stored in separate files.
How can I fix APKTOOL_DUMMY?
You can fix APKTOOL_DUMMY by replacing them with real values or using a script that automates the process. You need to decompile all the split APK files, merge them into one folder, replace the APKTOOL_DUMMY values with real ones, edit the AndroidManifest.xml, and recompile the APK.
Where can I find more information about APKTOOL_DUMMY?
You can find more information about APKTOOL_DUMMY on [this GitHub issue], where many users have discussed this problem and shared their solutions. 44f88ac181
コメント