---
# System prepended metadata

title: Move from APK to AAB

---

# Move from APK to AAB

## Common

#### Creating .aab atrtifacts

To build AAB we need to [use](https://developer.android.com/studio/build/building-cmdline#build_bundle) bundle*Variant* Gradle task.

#### Managing signing key
Both Google and Huawei have similar approach to deal with signing. For existing app that distributed as APK you should upload you current release signing key as .pepk file to Google/Huawei. This is needed because APKs from AAB creating dynamicly on server and server should sign this APKs. 

[How to upload](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-appsigning-releasedapp-0000001051818319) signing key to Huawei.
[How to upload](https://support.google.com/googleplay/android-developer/answer/9842756?hl=en) signing key to Google.

Both Google and Huawei recommends to create also uplodaing key, that will be used by Google/Huawei to check your uploaded AAB.

But we can use release signing key as upload key.

## Google

About [requiriments](https://android-developers.googleblog.com/2020/11/new-android-app-bundle-and-target-api.html) to move to App Bundle. We still can use APK for app updates.


#### Test builds and release cycle

Google add new feature to Play Console - [Internal app sharing](https://support.google.com/googleplay/android-developer/answer/9844679?visit_id=637491552619202175-3505928916&rd=1&hl=en). It allows to upload .aab and share it with testers. You can use any signing key in that case(if you use internal/beta/alpha test track in Play Console you should sign .aab with release key).

Some points:

- You can restrict access by email or allow anyone you share the link with to download.
- Version codes don't need to be new or unique
- Maximum of 100 users will be able to download your app using the link
- Download links expire 60 days after the upload date
- applicationId should be as release applicationId(suffixes and prefixes will not be accepted)

Internal app sharing is a good replacemant of AppCenter in case of using .aab instead of .apk.

First dev account owner should accept terms in Play console

![](https://i.imgur.com/zwxAwZh.png)


After that you should add uploaders: users who can upload artifacts

![](https://i.imgur.com/xyqy2gS.png)



After this similar work should be done with testers.

![](https://i.imgur.com/zLwbqtm.png)


Then upload [here](https://play.google.com/console/internal-app-sharing) your .aab. In this page you can also see all uploaded earlier artifacts.

**Very Important:**
Tester to download test build should turn on internal app sharing in Google Play app on their device([Here instruction](https://support.google.com/googleplay/android-developer/answer/9844679?hl=en#zippy=%2C%D0%B7%D0%B0%D0%B3%D1%80%D1%83%D0%B7%D0%BA%D0%B0-%D0%BF%D1%80%D0%B8%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D1%8F-%D0%B8-%D1%81%D0%BE%D0%B2%D0%BC%D0%B5%D1%81%D1%82%D0%BD%D1%8B%D0%B9-%D0%B4%D0%BE%D1%81%D1%82%D1%83%D0%BF-%D0%B4%D0%BB%D1%8F-%D1%82%D0%B5%D1%81%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F%2C%D0%B4%D0%BE%D0%B1%D0%B0%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5-%D0%B0%D0%B2%D1%82%D0%BE%D1%80%D0%B8%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%BD%D1%8B%D1%85-%D1%82%D0%B5%D1%81%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D1%89%D0%B8%D0%BA%D0%BE%D0%B2)). Short they should tap 7 times on Google Play version in setting, that Internal App Sharing switch will appears.

![](https://i.imgur.com/CYWvlme.png)

#### Automated uploading
For Google Play we have several options:
- [Use bash script](https://medium.com/swlh/google-playstore-and-automated-deployment-with-aab-a35eddabf128) that uses [Google Play Developer API](https://developers.google.com/android-publisher/getting_started)
- Use [unofficial gradle plugin](https://github.com/Triple-T/gradle-play-publisher)
- Write our own Gradle plugin that will use appropriate API to upload AAB artifact


## Huawei
For Huawei there are no any internal app sharing. 

But there is [open testing feature](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-betatest-release-0000001071228673) where we can speficy list of testers.

How to [upload release AAB](https://developer.huawei.com/consumer/en/doc/distribution/app/18527283).

#### Automated uploading
For App Gallery there is [Publishing API](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agcapi-upload_appfile) that we can use.

## About test builds
As Eugeniy suggest, we create new app entries for Sand, Regress, etc. builds in both stores Google Play and App Gallery.

Then we will be using internal test tracks in Google Play to share builds. After all tests passed on Sand(Regress, etc.) build we create RC build that will be uploaded to main Google Play Store app entry to internal test track. QA team perform smoke tests on RC and after it succeed, that RC build will be transefed to production track using Play Console UI.

For Huawei approach the same: we will create additional app entries. As Huawei App Gallery have only one test track we will be using it to share builds and perform smoke test on RC build.


