Edit or Modify the AAB file - change API 29 to 30 android 11

Edit or modify the aab file

This process will convert the apk into aab file

There is no way to edit or 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

requirements - python 3.6+ is required , Java 8 is required

Easy method - short

requirements - python 3.6+ is required , Java 8 is required and download Git

python and java both need to add in your environment variables path

To check java and python is installed or not
type these command python --version and java -version

C:\Users\amd>python --version
Python 3.9.6
C:\Users\amd>java -version
java version "1.8.0_301"
Java(TM) SE Runtime Environment (build 1.8.0_301-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.301-b09, mixed mode)

Step 1) open command Prompt and type below command

git  clone https://github.com/simple125345/APK_TO_AAB

after it downloaded then type below

cd APK_TO_AAB

Step 2) You need to download requirements for tool now just type the below command

pip install -r requirements.txt

In my case it already installed

Step 3) Now you download project as apk from Kodular creator and modify the androidmanifest.xml and set the targetsdk = 30

In this step be carefully if you do incorrect then your apk get corrupted

Well i faced some issues while do this

So changing target SDK 30 you can use apk editor or apk studio but my recommendation is do not use because androidmanifest.xml getting corrupted when i use apk editor or apk studio and i don’t know why it happening

The all issues get fixed when i use MT_Manager for changing the target SDK

follow go to your apk > androidmanifest.xml >change 29 to 30 and save it


change all 29 to 30 as given above image

now your apk is ready

Step 4) Now go to command prompt you have opened in Step 1 and type below command

python run.py -i "Path\abbtest.apk" -o "path\OutPutFolder\test.aab"

-i = input your apk path
-o = out put of your aab but you need to add this \youraabname.aab in end of your out put path

Out put will look like this

C:\Users\amd\Desktop\apk_to_aab\apk_to_aab>python run.py -i "C:\Users\amd\Desktop\apk_to_aab\apk_to_aab\abbtest.apk" -o "C:\Users\amd\Desktop\apk_to_aab\apk_to_aab\OutPutFolder\myaab.aab"
---Environment_&_parameter_verification
[Current_system]:Windows
[Current_system_JAVA_version]#####:
[Enter_apk]:C:\Users\amd\Desktop\apk_to_aab\apk_to_aab\abbtest.apk
[Output_aab]:C:\Users\amd\Desktop\apk_to_aab\apk_to_aab\OutPutFolder\myaab.aab
[sign]:C:\Users\amd\Desktop\apk_to_aab\apk_to_aab\libs\key.jks,storepass:123456789,alias:123456789,keypass:123456789
##################################################
Window_does_not_check_to_avoid_libraries_without_openssl
##################################################
[apktool]:C:\Users\amd\Desktop\apk_to_aab\apk_to_aab\libs\apktool-2.5.2-fixed.jar
[apktool_version_number]:#####
[aapt2]:C:\Users\amd\Desktop\apk_to_aab\apk_to_aab\libs\aapt2\Windows\aapt2
[aapt2_version_number]:#####
[android]:C:\Users\amd\Desktop\apk_to_aab\apk_to_aab\libs\android_sdk.jar
[bundletool]:C:\Users\amd\Desktop\apk_to_aab\apk_to_aab\libs\bundletool-all-1.8_fix.jar
[bundletool_version_number]:#####
----time_consuming :0.5082008838653564 Environment_&_parameter_verification status:0 msg:success
---Unzip_input_apk
----time_consuming :3.4500231742858887 Unzip_input_apk  status:0 msg:I: Using Apktool 2.5.1 on abbtest.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\amd\AppData\Local\apktool\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Copying raw classes.dex file...
I: Copying raw classes2.dex file...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...

---Parse_apk_information
----time_consuming :0.004002094268798828 Parse_apk_information status:0 msg:success
---[base]-Build_the_module_compression_package
---[base]-Compile_resources
----time_consuming :0.8130829334259033 [base]-Compile_resources status:0 msg:
---[base]-Associated_resources
----time_consuming :0.4404003620147705 [base]-Associated_resources status:0 msg:
---[base]-Unzip_resources_apk
----time_consuming :0.4153752326965332 [base]-Unzip_resources_apk status:0 msg:success
---[base]-Mobile_AndroidManifest
----time_consuming :0.008008241653442383 [base]-Mobile_AndroidManifest status:0 msg:success
---[base]-Copy_assets
----time_consuming :0.05104422569274902 [base]-Copy_assets status:0 msg:success
---[base]-Process_the_original_apk_signature_information
----time_consuming :0.0 [base]-Process_the_original_apk_signature_information status:0 msg:success
---[base]-Copy_META-INF
----time_consuming :0.01701641082763672 [base]-Copy_META-INF status:0 msg:success
---[base]-Copy_dex
----time_consuming :0.030025720596313477 [base]-Copy_dex status:0 msg:success
---[base]-Compressed_zip
----time_consuming :2.3358728885650635 [base]-Compressed_zip status:0 msg:success
----time_consuming :4.12283730506897 [base]-Build_the_module_compression_package status:0 msg:success
---Build_config_json
----time_consuming :0.000997304916381836 Build_config_json status:0 msg:success
---Build_aab
----time_consuming :1.4857299327850342 Build_aab status:0 msg:
---sign
----time_consuming :1.434300422668457 sign status:0 msg:jar signed.

Warning:
The signer's certificate is self-signed.

---Copy_output_copy
----time_consuming :0.0050046443939208984 Copy_output_copy status:0 msg:success

C:\Users\amd\Desktop\apk_to_aab\apk_to_aab>

all done now your aab file is generated in out put path

Well i used temporary key to sign your aab file and in order to publish your aab file in play console you need to sign with your own key follow my pervious guide sign your abb or tutorial for signing an aab file by @Point or you can place your keystore in /libs/android.keystore it will automatically sign your aab file with your key

link of software used in this post -
tool - simple125345/APK_TO_AAB (github.com)
MIT Manager - MT Manager

if your androidmanifest.xml longer than 217 line then use apk tool or apk editor because MT manager have some limits and you can follow this guide to customize the manifest by @bodymindpower

if you got error like this below

status:-1 msg:Input file ((3)\myapp.apk) was not found or was not readable.

means your androidmanifest.xml is corrupted that is a reason why i said to use MT Manager and all jar files in my tool are having latest version

hard method - long

Tools are required

  • bundletool-all-1.8.0.jar
    Bundletool.jar is a tool that Google provides to generate and test aab, and is also used in gradle packaging
    Download from here bundletool

  • aapt
    aapt full name Android Asset Packaging Tool is the Android Resource Packer.
    Download from here aapt
    after downloading aapt just unzip the aapt.jar and extract aapt.exe from it

  • apk tool
    Decompile the Android Apk
    Download from here Apk tool

  • Android SDK jar
    Download from here SDKPlatform

Place all file in one folder

Step 1) Unzip the apk package via apktool
type below command in cmd where all your jar file is placed

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

After unziping the apk decomplied_apk_Path directory structure will look like this:

./decomplied_apk_Path
├── AndroidManifest.xml
├── apktool.yml
├── assets
├── classes2.dex
├── classes.dex
├── lib
├── original
├── res
└── unknown

Now edit the androidmanifest.xml and set target sdk from 29 to 30

Step 2 ) Compile the resource

Compilation resources use aapt2 compilation to generate a collection of .flat files

type below command in cmd where all your jar file is placed

aapt2 compile --dir decomplied_apk_Path\res -o compiled_resources.zip

Build compiled_resources.zip file

Step 3) complied the all resources in to proto format

Now carefully type below command in cmd and replace your files path with it

aapt2 link --proto-format -o base.apk -I android_30.jar --min-sdk-version 19 --target-sdk-version 30 --version-code 1 --version-name 1.0 --manifest decomplied_apk_Path\AndroidManifest.xml -R compiled_resources.zip --auto-add-overlay


This will build a base.apk in your out put path

Step 4 ) Unzip the base .apk in new folder

the directory structure will look like this:

./base
├── AndroidManifest.xml
├── res
└── resources.pb

Step 5) Be carefully at this point

Copy resources

Take the base folder as the root

copy the androidmanifest.xml from extracted base.apk and paste to base/Android Manifest.xml folder

Copy assets folder of your original apk to base/assets

if your original apk contains libs then Copy lib of your original apk to to base/lib

if your original apk contains unknown folder then Copy unknown to /base/root

if your original apk contains kotlin then copy kotlin of your original apk to base/root/kotlin

Create a ./base/dex folder and copy all dex file from your original apk and paste all dex file /base/dex

create an folder out side of base folder and name “META-INF”

============> base/AndroidManifest.xml
============> base/assets
============> base/lib
============> base/root
============> base/root/kotlin
============> base/dex/*.dex

The final directory structure will look like this

base/
├── assets
├── dex
├── lib
├── manifest
├── res
├── resources.pb
└── root

Step 6) Compress the base folder into base.zip be sure to .zip not .rar

Step 7) Compile aab

Packing a bundle requires bundletool

now type below command in your cmd where all jar are placed and replace with your file

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

Step 8) aab signature

now your base.aab need to be sign follow this guide

all done

Some common errors fix

Your apk and your outputFolder or the folder where you placed the apk should not contains the these ([email protected]#$%^&*) word or symbol in name

example ~
python run.py -i "C:\Users\amd\Desktop\j\a.apk" -o "C:\Users\amd\Desktop\j\o\test.aab" :white_check_mark:

python run.py -i "C:\Users\amd\Desktop\j 2\a (1).apk" -o "C:\Users\amd\Desktop\j 2\o\test.aab" :x:

  1. if you got error below like this means your apk is corrupted or you incorrectly modify it
    task Unzip input_apk Execution abnormal status:-1 msg:Input file ((7)\a.apk) was not found or was not readable.

  2. if you got error below like this

---time consuming:0.2658720016479492 Environment & parameter verification status:-2 msg:success
task Environment & parameter verification Execution abnormal status:-2 msg:success

then here is some common fixes
this -2 error only come when python 3.6 + , java 8 + is not installed or requirements.txt module is not installed
or just delete that tool and reinstall it and some jar file are get block by antivirus software just disable it and disable the real-time protection and if java process is already running then kill the process in task manager
most of the time this error only come when java is already running or java is using other application

choice is yours to chose easy method or hard method

easy method have python script which will do all thing just input apk and hard method is manual way to do

Don’t use any extension from Deephost because deephost doesn’t provide support for his extension here is an example

well i took 16 hours to make this possible i hope you guys will like it :+1:

42 Likes

Lets try this out :grinning_face_with_smiling_eyes:

Great Guide @Shreya.ig :heart::fire:
I’ll surely check this :grin: :blush:

1 Like

thank you :grinning_face_with_smiling_eyes: :grinning_face_with_smiling_eyes:

1 Like
D:\User\Downloads\apk_to_aab>python run.py -i "D:\User\Downloads\apk_to_aab\neww_copy.apk" -o "D:\User\Downloads\apk_to_aab\OutPutFolder\test.aab"
---Environment_&_parameter_verification
[Current_system]:Windows
[Current_system_JAVA_version]#####:
[Enter_apk]:D:\User\Downloads\apk_to_aab\neww_copy.apk
[Output_aab]:D:\User\Downloads\apk_to_aab\OutPutFolder\test.aab
[sign]:D:\User\Downloads\apk_to_aab\libs\key.jks,storepass:123456789,alias:123456789,keypass:123456789
##################################################
Window_does_not_check_to_avoid_libraries_without_openssl
##################################################
[apktool]:D:\User\Downloads\apk_to_aab\libs\apktool-2.5.2-fixed.jar
[apktool_version_number]:#####
[aapt2]:D:\User\Downloads\apk_to_aab\libs\aapt2\Windows\aapt2
[aapt2_version_number]:#####
[android]:D:\User\Downloads\apk_to_aab\libs\android_sdk.jar
[bundletool]:D:\User\Downloads\apk_to_aab\libs\bundletool-all-1.8_fix.jar
[bundletool_version_number]:#####
----time_consuming :0.07627701759338379 Environment_&_parameter_verification status:-2 msg:success
task Environment_&_parameter_verification Execution_exception_status:-2 msg:success

can you help me. it just shows up like this. it doesn’t output aab

check your “D:\User\Downloads\apk_to_aab\OutPutFolder\test.aab”
your aab is located in your out put path

2 Likes

i checked but the folder is empty

post your full out put here that was half out put

1 Like

that’s all

did you install the requirements ?? without that software can’t run

show me your python version

1 Like
D:\User\Downloads\apk_to_aab>pip install -r requirements.txt
Collecting PyYAML==5.4.1
  Downloading PyYAML-5.4.1-cp39-cp39-win_amd64.whl (213 kB)
     |████████████████████████████████| 213 kB 6.8 MB/s
Installing collected packages: PyYAML
Successfully installed PyYAML-5.4.1
WARNING: You are using pip version 21.1.3; however, version 21.2.4 is available.
You should consider upgrading via the 'c:\users\user\appdata\local\programs\python\python39\python.exe -m pip install --upgrade pip' command.

D:\User\Downloads\apk_to_aab>python run.py -i "Path\neww_coppy.apk" -o "path\OutPutFolder\test.aab"
---Environment_&_parameter_verification
[Current_system]:Windows
[Current_system_JAVA_version]#####:
[Enter_apk]:D:\User\Downloads\apk_to_aab\Path\neww_coppy.apk
----time_consuming :0.02094292640686035 Environment_&_parameter_verification status:-1 msg:The_entered_apk_does_not_exist:D:\User\Downloads\apk_to_aab\Path\neww_coppy.apk
task Environment_&_parameter_verification Execution_exception_status:-1 msg:The_entered_apk_does_not_exist:D:\User\Downloads\apk_to_aab\Path\neww_coppy.apk

D:\User\Downloads\apk_to_aab>python run.py -i "\neww_coppy.apk" -o "\OutPutFolder\test.aab"
---Environment_&_parameter_verification
[Current_system]:Windows
[Current_system_JAVA_version]#####:
[Enter_apk]:D:\neww_coppy.apk
----time_consuming :0.012965917587280273 Environment_&_parameter_verification status:-1 msg:The_entered_apk_does_not_exist:D:\neww_coppy.apk
task Environment_&_parameter_verification Execution_exception_status:-1 msg:The_entered_apk_does_not_exist:D:\neww_coppy.apk

D:\User\Downloads\apk_to_aab>python run.py -i "D:\User\Downloads\apk_to_aab\neww_copy.apk" -o "D:\User\Downloads\apk_to_aab\OutPutFolder\test.aab"
---Environment_&_parameter_verification
[Current_system]:Windows
[Current_system_JAVA_version]#####:
[Enter_apk]:D:\User\Downloads\apk_to_aab\neww_copy.apk
[Output_aab]:D:\User\Downloads\apk_to_aab\OutPutFolder\test.aab
[sign]:D:\User\Downloads\apk_to_aab\libs\key.jks,storepass:123456789,alias:123456789,keypass:123456789
##################################################
Window_does_not_check_to_avoid_libraries_without_openssl
##################################################
[apktool]:D:\User\Downloads\apk_to_aab\libs\apktool-2.5.2-fixed.jar
[apktool_version_number]:#####
[aapt2]:D:\User\Downloads\apk_to_aab\libs\aapt2\Windows\aapt2
[aapt2_version_number]:#####
[android]:D:\User\Downloads\apk_to_aab\libs\android_sdk.jar
[bundletool]:D:\User\Downloads\apk_to_aab\libs\bundletool-all-1.8_fix.jar
[bundletool_version_number]:#####
----time_consuming :0.1087944507598877 Environment_&_parameter_verification status:-2 msg:success
task Environment_&_parameter_verification Execution_exception_status:-2 msg:success

D:\User\Downloads\apk_to_aab>

D:\User\Downloads\apk_to_aab>

D:\User\Downloads\apk_to_aab>python run.py -i "D:\User\Downloads\apk_to_aab\neww_copy.apk" -o "D:\User\Downloads\apk_to_aab\OutPutFolder\test.aab"
---Environment_&_parameter_verification
[Current_system]:Windows
[Current_system_JAVA_version]#####:
[Enter_apk]:D:\User\Downloads\apk_to_aab\neww_copy.apk
[Output_aab]:D:\User\Downloads\apk_to_aab\OutPutFolder\test.aab
[sign]:D:\User\Downloads\apk_to_aab\libs\key.jks,storepass:123456789,alias:123456789,keypass:123456789
##################################################
Window_does_not_check_to_avoid_libraries_without_openssl
##################################################
[apktool]:D:\User\Downloads\apk_to_aab\libs\apktool-2.5.2-fixed.jar
[apktool_version_number]:#####
[aapt2]:D:\User\Downloads\apk_to_aab\libs\aapt2\Windows\aapt2
[aapt2_version_number]:#####
[android]:D:\User\Downloads\apk_to_aab\libs\android_sdk.jar
[bundletool]:D:\User\Downloads\apk_to_aab\libs\bundletool-all-1.8_fix.jar
[bundletool_version_number]:#####
----time_consuming :0.07627701759338379 Environment_&_parameter_verification status:-2 msg:success
task Environment_&_parameter_verification Execution_exception_status:-2 msg:success

D:\User\Downloads\apk_to_aab>

D:\User\Downloads\apk_to_aab>

Yes. I followed your instructions exactly, but I don’t know where the error is. Thank you for your support

send me your apk in my pm @Uyen_Chau

the problem is with python version

1 Like

bundle tool jar was corrupted

i just download the new from here simple125345/APK_TO_AAB (github.com)
i just checked now

@Uyen_Chau you can download the tool from here simple125345/APK_TO_AAB (github.com)

i will update the post within 5 min and your apk was success and generated aab

2 Likes

I’m dealing with the same issue. I have downloaded the zip from github and tried again but output is same

C:\Users\Xavier\Desktop\apk_to_aab\apk_to_aab>python run.py -i “C:\Users\Xavier\Desktop\apk_to_aab\apk_to_aab\Bachat_Bazaar.apk” -o “C:\Users\Xavier\Desktop\apk_to_aab\apk_to_aab\output\Bachat_Bazaar.aab”
—Environment_&parameter_verification
[Current_system]:Windows
[Current_system_JAVA_version]#####:
[Enter_apk]:C:\Users\Xavier\Desktop\apk_to_aab\apk_to_aab\Bachat_Bazaar.apk
[Output_aab]:C:\Users\Xavier\Desktop\apk_to_aab\apk_to_aab\output\Bachat_Bazaar.aab
[sign]:C:\Users\Xavier\Desktop\apk_to_aab\apk_to_aab\libs\key.jks,storepass:123456789,alias:123456789,keypass:123456789
##################################################
Window_does_not_check_to_avoid_libraries_without_openssl
##################################################
[apktool]:C:\Users\Xavier\Desktop\apk_to_aab\apk_to_aab\libs\apktool-2.5.2-fixed.jar
[apktool_version_number]:#####
[aapt2]:C:\Users\Xavier\Desktop\apk_to_aab\apk_to_aab\libs\aapt2\Windows\aapt2
[aapt2_version_number]:#####
[android]:C:\Users\Xavier\Desktop\apk_to_aab\apk_to_aab\libs\android_sdk.jar
[bundletool]:C:\Users\Xavier\Desktop\apk_to_aab\apk_to_aab\libs\bundletool-all-1.8_fix.jar
[bundletool_version_number]:#####
----time_consuming :0.0688486099243164 Environment
&parameter_verification status:-2 msg:success
task Environment
&_parameter_verification Execution_exception_status:-2 msg:success

C:\Users\Xavier\Desktop\apk_to_aab\apk_to_aab>

1 Like

invalid commands
-i path\your.apk and -o path\test.aab

1 Like

I have entered the same command as you did.
C:\Users\amd\Desktop\apk_to_aab\apk_to_aab>python run.py -i “C:\Users\amd\Desktop\apk_to_aab\apk_to_aab\abbtest.apk” -o “C:\Users\amd\Desktop\apk_to_aab\apk_to_aab\OutPutFolder\myaab.aab”

1 Like

I have downloaded and tried many times still not working. it’s still the same as before. can you help me check again. Thank you very much

wait i will make an video this will help all

4 Likes

APK_TO_AAB-main file corrupted please help me

here is an video

in this video i used apk given by @udai_veer and it successfully generated aab file shown in video

everything is working

6 Likes