Convert APK TO AAB File

Convert APK TO AAB File

This process will convert the APK into AAB file

There is no way to modify the file in aab because all file get encoded with protocol-buffers but we can edit the apk and modify it easily. So this process will convert modify apk into aab file

Windows Converter

Windows-exe

Download APK2AAB
Requirements - Java 8 & add to system variable
Download .Net 6.0 runtime only Download .NET 6.0 (Linux, macOS, and Windows)

Exe file found in APK2AAB\Windows-exe\APK2AAB.exe

Selected apk & out put aab path should not contain any space in directory path
Min-sdk , target sdk , version name & code should be same as your apk have in AndroidManifest.xml
You need to sign the generated aab file with your keystore in order to publish the application in play store

You can use jarsigner for signing aab file

Android Converter

Android-Tool-APK2AAB

Download APK2AAB
Apk file found in APK2AAB\Android-Tool\APK2AAb.apk

Download the application and install it
Pick the apk and select output path for aab file
Your file generate in output path
You need to sign the generated aab file with your keystore in order to publish the application in play store

Manual way

Required Tools :

Bundletool.jar Releases · google/bundletool · GitHub

Apktool.jar GitHub - iBotPeaches/Apktool: A tool for reverse engineering Android apk files

Aapt2.exe https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/4.2.1-7147631/aapt2-4.2.1-7147631-windows.jar

Android.jar Get the ANDROID SDK: $ANDROID_SDK/platforms/android-$latestVersion/android.jar

Jave 8 Java Archive Downloads - Java SE 8 | Oracle India
Add to system variable https://www.java.com/en/download/help/path.html

Unzip the apk

Put all tool files in one folder
Open your command prompt in current directory
Decompile the apk through apktool.jar

execute below command in command line

java -jar apktool_2.5.0.jar d test.apk -s -o decompile_apk -f

Compile the resource

Compile the resources using aapt2

aapt2.exe compile --dir decompile_apk\res -o res.zip

After that you will see a res.zip will generate in your current directory

Link the resources

execute below command in command line

aapt2.exe link --proto-format -o base.zip -I android.jar --manifest decompile_apk\AndroidManifest.xml --min-sdk-version $version --target-sdk-version $version --version-code $version --version-name $version -R res.zip --auto-add-overlay

$version should be replace with your apk version for example my apk have min-sdk is 7 , target-sdk is 30 , version-code is 1 , verison-name is 1.0 . So my command will be →

aapt2.exe link --proto-format -o base.zip -I android.jar --manifest decompile_apk\AndroidManifest.xml --min-sdk-version 7 --target-sdk-version 30 --version-code 1 --version-name 1.0 -R res.zip --auto-add-overlay

After that you will see a base.zip will generate in your current directory

Unzip the base.zip

Directory structure:

base/
/AndroidManifest.xml
/res
/resources.pb

Copy the files
Take base folder as your main folder for now !
Create a folder manifest name folder inside base folder and move your base/AndroidManifest.xml to manifest/AndroidManifest.xml
copy whole assets folder from decompile_apk/assets and paste to base/assets
copy lib folder from decompile_apk/lib and paste to base/lib
copy all files inside unknown folder from decompile_apk/unknown and paste to base/root
copy whole kotlin folder from decompile_apk/kotlin and paste to base/root/kotlin

Final directory structure

base/
/assets
/dex
/lib
/manifest
/res
/root
/resources.pb

Create a zip

Open your command prompt in /base directory

we are going to create a zip using cmd or you can use any software like Winrar & 7zip

execute below command in command line

jar cMf base.zip manifest dex res root lib assets resources.pb

It will create base.zip in current directory now copy the base.zip and paste where you put all tool file (.jars , .exe)

Compile aab
Open your command prompt in /tools directory

execute below command in command line

java -jar bundletool.jar build-bundle --modules=base.zip --output=base.aab

base.aab file will generate in current folder
You need to sign the generated aab file with your keystore in order to publish the application in play store

Support

If you liked my work, you can support me - paypal.me

9 Likes

grafik

Great and very helpful!

1 Like

@Shreya Ma’am = :fire:

1 Like

@Anke @Avijit
Thank you :smiling_face:

2 Likes

Thanks :+1::+1::+1:

1 Like