/APK2AAB

APK2AAB

Primary LanguageBatchfileApache License 2.0Apache-2.0

APK2AAB

Windows-exe

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

Download .Net 6.0 runtime https://dotnet.microsoft.com/en-us/download/dotnet/6.0 & Java 8 & add to system variable

Selected apk & out put aab path should not contain any space in directory
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

Android-Tool

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

Tools are required

Bundletool.jar https://github.com/google/bundletool/releases

Apktool.jar https://github.com/iBotPeaches/Apktool

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 https://www.oracle.com/in/java/technologies/javase/javase8-archive-downloads.html
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