Android AAB Support

adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,034
edited October 2021 in Release Notes

We now have preliminary support for Android App Bundles (also known as AABs).

New apps uploaded to the Google Play Store are required to be in AAB format. The advantage of the format is smaller download sizes as the Google Play Store will process AABs to extract only parts of the APK required for a particular device.

To build an AAB from your game just click the Build AAB on and Android target of your publishing page.

Your game assets will be bundled in the AABs to use Play Asset Delivery, which means you no longer have to worry about expansion files and the attending loading time costs. If you are familiar with the configurations for PAD, we are using the 'install-time' delivery type, which means your assets will be made available as part of the initial install even if they are downloaded separately.

This release also includes updates to IronSrc to match the most recent release and removes the ability to support multiple full screen ad providers. This multiple ad providers feature was a poor attempt at mediation and has been made redundant with support of ad mediation through IronSrc and Admob (and simplifies our code base).

For now, you will need to sign your own AAB files with jarsigner. You should google "signing aab files command line". For me the top result is: https://stackoverflow.com/questions/50560045/sign-android-app-bundle-from-command-line

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore xample.jks bundle.aab keystoreAlias

Finally, because the AAB process is much more robust, we suggest using it as a basis to getting your APKs instead of our publishing process.

You will need to download bundletool which allows you to extract APKs from your AAB from here: https://github.com/google/bundletool/releases

I just throw the jar file into my android-sdk directory and do the following:

java -jar ~/android-sdk/bundletool-all-1.8.0.jar build-apks --ks=~/keystores/<your>.keystore --ks-key-alias=<your keystore alias> --mode=universal --bundle <path to my aab file> --output=<path to output apks. needs to end in .apks>

This generates a zip file with a signed "universal" apk (which is basically what you're used to working with). If you want to get the apk out of the file without unzipping everything you can use this command (on mac)

unzip -p game.apks universal.apk > my_game.apk

We also have more detailed signing instructions:

Windows: https://help.gamesalad.com/windows-cookbook/publishing/android-publishing/android-app-bundle-aab-command-line-signing/

Mac: https://help.gamesalad.com/gamesalad-cookbook/publishing/4-android-publishing/android-app-bundle-aab-terminal-signing/

«134

Comments

  • freneticzfreneticz SwedenMember, PRO Posts: 774

    So we cant just put the aab on the phone like with apk to test the game?

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,034

    @freneticz no the aab is meant to be a store target that is used to create APKs. The bundletool command (the third one) will allow you to create a universal APK from the aab that can be installed on any device.

    If you remove the --mode=universal command line argument, it will generate all the APK permutations for various devices.

    You can learn more here: https://developer.android.com/studio/command-line/bundletool

  • ArmellineArmelline Member, PRO Posts: 5,327

    Excellent news! Will take the time to give this a whirl tomorrow! Thanks for the hard work on this!

  • ArmellineArmelline Member, PRO Posts: 5,327
    edited August 2021

    @adent42 Trying to generate some AABs. Been a while (20+ minutes) so far and they're still going. Not sure if it just takes longer or if they are stuck?

    Edit: It had been done, the page just didn't update until a force refresh was done.

  • uptimistikuptimistik Key Master, Member, Sous Chef, PRO Posts: 253

    Can't sign. Using this command:

    jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore xample.jks bundle.aab keystoreAlias
    

    I created a .jks keystore (SHA1 with RSA) and keep getting the error:

    Certificate chain not found for: keystoreAlias. keystoreAlias must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.

    Unable to find an adequate solution in the StackFlow forums for this one :(

    GameSalad Templates and Custom Development at the Official Marketplace: http://gshelper.com

  • ArmellineArmelline Member, PRO Posts: 5,327

    Did you definitely replace "keystoreAlias" with the exact alias you gave when making your keystore? I missed that first time and got the same error. The signing string quoted above is definitely not sufficient though. When I successfully upload I'll update with the one I used.

  • ArmellineArmelline Member, PRO Posts: 5,327
    edited August 2021

    Okay, I have a build uploaded to Google that they're happy with. I had to stray from the instructions at the top a bit. Here's what I did. Note that this is a NEW upload to Google, so I was starting from scratch with no existing keystore to deal with.

    My game is called "Sand" so that's the name I used in these examples.

    Generated a jks keystore:

    keytool -genkey -alias sand -keyalg RSA -keystore ~/sand.jks -validity 100000
    

    Not including the -validity 100000 resulted in an error when uploaded to Google. They complained that my certificate expired too soon.

    This then recommended I update the keystore using a command it provided, which I did. At some point I'll check how to skip that step.

    Then I signed it using the command from above, adapted to my keystore.

    jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore /Path/To/Keystore/sand.jks /Path/To/downloadedAAB/Sand.aab Sand
    

    Note that this signs over the existing aab, it doesn't create a new "signed" aab. So backup your aab file first in case, like me, you make a mistake first time. I had to download the aab file again from GameSalad.

    I was then able to upload the signed aab file to the play console with no problems.

    I imagine that all of this could be done via the publishing process when @adent42 has time to update it. But for now we have to jump through Google's insane hoops.

  • ArmellineArmelline Member, PRO Posts: 5,327
    edited August 2021

    Also there's a small edit needed for the unzip command given above - note the close bracket sign added before my_game.apk. That makes it actually output the file not just print it to the Terminal window.

    unzip -p game.apks universal.apk >my_game.apk
    

    It'll need paths for both the game.apks and the my_game.apk. For me the command was this, since I had the apks in my downloads folder and wanted the apk in the same location. Not providing a path will put it in your home directory.

    unzip -p /Users/armelline/Downloads/Sand.apks universal.apk >/Users/armelline/Downloads/Sand.apk
    


  • ArmellineArmelline Member, PRO Posts: 5,327
    edited August 2021

    Depending on the expected timeframe to get this stuff automated in the publishing process, I could throw together some quick and ugly Applescript apps to do the legwork of these steps. I'll wait and see @adent42's expected timeframe though as I'm fairly busy at the moment and don't want to spend the time if we're looking at a week or two of manual signing.

  • uptimistikuptimistik Key Master, Member, Sous Chef, PRO Posts: 253

    Worked like a charm @Armelline thanks man. Your updated instructions did the trick nicely.

    GameSalad Templates and Custom Development at the Official Marketplace: http://gshelper.com

  • AshumBesherAshumBesher Member, PRO Posts: 121

    Hello. I followed all of the steps correctly to sign the .aab and extract the .apk from it. But when I test the .apk on my phone, It force closes straight away.

    I use Windows to make and sign my app, and I tested the game on my phone by updating the previous version, I haven't tried a clean install.

  • AshumBesherAshumBesher Member, PRO Posts: 121

    I've just tried testing my game's .aab via the internal testing track in the Google dev console, same result, app force closes on opening. Any idea what's causing this?

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,034
    edited August 2021

    @AshumBesher could you send me a publishing link so I can try to see what's up? The most common crash cause in my testing was a lack of Admob App ID when using either Admob or IronSrc with Admob enabled. It's now required to have the Admob App ID and will crash without it. I want to take a look and see if it's that (maybe we're failing to write it in correctly in some cases) or if it's something new with your particular config choices on our publishing console that we didn't get to test.

  • ArmellineArmelline Member, PRO Posts: 5,327

    Still getting reports of crashing on startup with the AAB derived APK, on a certain Android device. No ads are used in this game. I'm trying to get exact device and Android OS details from the person experiencing the crash. What they said initially was X3 Pro and Android 11, but trying to confirm specifics.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,034

    @Armelline I updated one of the library dependencies, so try regenerating and see how it works. I'll try to find an Android 11 device to try out.

  • pinkio75pinkio75 Member, PRO Posts: 1,211
    edited August 2021

    Hi, i created my first .AAB but when i try to upload in Gplay console it show me an error:

    in practice I have to subscribe to the key program:

    Google does not protect the signing key of your app. Sign up for the program to use the Android App Bundle.


    because I try to replace an APK with an AAB and I don't understand what exactly I have to do.

    I've always used the same keystore for all my apps ... so what should I do in this case?

    There are 3 options:

    Activate the Play App Signing program

    1) Export and upload a key from Android Studio

    2) Export and load a key from the Java keystore

    3) Export and load a key (which does not use the Java keystore)


    And in all cases until when no longer be possible to load .APKs to update our existing games?

    Thanks to anyone.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,034

    FYI the issues some people have been seeing with crashing is an issue with API 30 and Android 11. We're testing a release targeting API 31 to see if the issue is fixed and will let you know soon.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,034

    So API 31 doesn't fix the issues. We're looking into how we trigger the issue and work around it. Google changed something about how they handle thread workers (delayed background task), that is causing issues on some Android 11 devices. Most advice on google is to just revert to API 29, but that's no longer an option. We'll keep you posted.

  • freneticzfreneticz SwedenMember, PRO Posts: 774
  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,034

    Updated the AAB. A minor bug fix related to game services, still uses API 30, uses an updated NDK (compiler toolchain for the native parts of the engine), and updated all the IronSrc libraries.

    In testing on Amazon Device Farm, it still crashes on the Galaxy A71 and Tab S7 but is fine on all other available Android 11 devices.

    The crash seems to be somewhere in the Android OpenGL code, so it's not something we can easily fix, track down.

    So while this won't be 100%, it's a lot better than what was there before. Just hit Generate AAB again and test it / resubmit.

    This will be all I can do with this issue for now, at least until we can get our hands on an Android 11 Samsung device.

    For the short term I think what we'll be doing is moving on to generate APKs from the new code base so that APK generation is also up-to-date, and then we'll move on to working on an updated standalone signing app. While we could also look into signing on the server, I've decided (in the short term at least) that we don't want the headache of managing your keys yet.

    After those two items, we'll get back with the community and figure out our roadmap for what's next on the engine side.

  • pinkio75pinkio75 Member, PRO Posts: 1,211
    edited September 2021

    Hi @adent42,

    but i've one a error when i try to publish my signed .AAB; below the error:

    "We have found that an unsupported version of Play Billing is being used for this app. To publish this app, you must upgrade to version 3 or later of the Billing Library. Learn more about the Billing Library 3."

    The error is present after your last update; i don't remember this error with older release.

    Someone have the same issue?

  • AshumBesherAshumBesher Member, PRO Posts: 121

    My game still crashes on launch on my Samsung Galaxy S10 Lite after I update from my older app version to the latest .aab. Any luck finding the the issue with the SQLLite?

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,034

    @AshumBesher unfortunately no, though I think there are other issues.

  • ZombieFactory GamesZombieFactory Games Member, PRO Posts: 20

    Same issue than @pinkio75 here

    Actually can't update a game on Android since Google detects a old version of Play Billing.

    I also tried with making a AAB file, but get the same error.

    Did someone found a solution?

    Thanks

  • pinkio75pinkio75 Member, PRO Posts: 1,211
    edited September 2021
  • ZombieFactory GamesZombieFactory Games Member, PRO Posts: 20

    It seems to also affect .APK indeed...

    I wanted to update a game I made one week ago, didn't made any changes and got the error from Google.

    Then I tried with .aab build but still have the issue :/

    I'm stuck for now, don't know what to do.

    Here's the screenshot (in french sorry)


  • pinkio75pinkio75 Member, PRO Posts: 1,211
    edited September 2021
Sign In or Register to comment.