Recent

Author Topic: LAMW + Android App Bundles  (Read 6266 times)

Manlio

  • Full Member
  • ***
  • Posts: 126
  • Pascal dev
LAMW + Android App Bundles
« on: November 13, 2019, 03:14:13 pm »
Google's recommended way of publishing apps on the Play Store is not an APK, but an "App Bundle" (*.aab files).

Currently, the only way I can see to do that is with Android Studio.

But personally I like it very much that I can create my APK files with LAMW, with Ant or Gradle, using the script files (e.g. gradle-local-build.bat, gradle-local-apksigner.bat). That works perfectly and I don't need to mess with Android Studio at all.

So, can any one tell us if it's going to be possible to create AAB files as well as APK files from LAMW? Or with some script files? That would be great!

https://developer.android.com/guide/app-bundle/

TLDR: A key advantage of the new AAB system is this. When you upload your apps to Google Play Store, you must typically include at least a 32 bit and a 64 bit version of libcontrols.so. But when users download it, they only need one or the other, not both. If you upload APKs, users will have to download everything (the "fat" APK). But with the new app bundle system, google removes what is not needed, so, for example, 32-bit devices will get an APK with only the 32 bit libcontrols.so, and 64-bit devices will get an APK with only the 64 bit version of the same.

Similarly, I believe it is possible to specify that certain resources will be given to 32 bit devices, other resources to 64 bit devices, and so on.

I wouldn't be too surprised if at some point google will deprecate APK uploads and require everyone to only upload AAB files (Android App Bundles)

Bottom line, it would be nice to have a simple way to make AAB files.

Thanks!
manlio mazzon gmail

neuro

  • New Member
  • *
  • Posts: 26
Re: LAMW + Android App Bundles
« Reply #1 on: July 01, 2021, 04:40:12 pm »
The deadline is close – “Google Play Console” contains a warning:
Quote
New Android App Bundle and target API level requirements in 2021
Mar 23, 2021
Starting August 2021, new apps will be required to target API level 30 (Android 11) and use the Android App Bundle publishing format. Starting November 2021, all app updates will be required to target API level 30 (Android 11). Apps with a download size of more than 150 MB are now supported by Play Asset Delivery and Play Feature Delivery.

Quote
https://android-developers.googleblog.com/2020/11/new-android-app-bundle-and-target-api.html
New Android App Bundle and target API level requirements in 2021
19 November 2020
Posted by Hoi Lam, Developer Relations Engineer, Android Platform

In 2021, we are continuing with our annual target API level update, requiring new apps to target API level 30 (Android 11) in August and in November for all app updates. In addition, as announced earlier this year, Google Play will require new apps to use the Android App Bundle publishing format. This brings the benefits of smaller apps and simpler releases to more users and developers and supports ongoing investment in advanced distribution.

How to build "App Bundle" (*.aab files) files for “Google Play”?

jmpessoa

  • Hero Member
  • *****
  • Posts: 1945
Re: LAMW + Android App Bundles
« Reply #2 on: July 01, 2021, 09:05:16 pm »
Quote
How to build "App Bundle" (*.aab files) files for “Google Play”?

Lazarus IDE --> "Tools"  --> "[LAMW]...." --> "Build Release......."

Maybe you will need do a "build" using aarch64, too. If true then go to Project Options --> [LAMW] ---> "Build"....
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Manlio

  • Full Member
  • ***
  • Posts: 126
  • Pascal dev
Re: LAMW + Android App Bundles
« Reply #3 on: July 01, 2021, 11:03:20 pm »
Thanks to jmpessoa for providing a way to build AAB files via the IDE.

A similar option exists within Android Studio. However, in that case, you need to have all your files and libraries within the typical Android Studio project folder structure, and in that case it may be tricky to maintain a LAMW project within both the Lazarus and the Android Studio folder structures at the same time.

Personally, my preferred and ideal solution is to have a one-click build script that is independent from any IDE. I use Lazarus with LAMW to write and test the project, but when it comes to the final build for public distribution, I prefer to have an independent script to do everything, which now includes creating the AAB file for Google Play.

Here I found Google's guidelines for creating an AAB file via command line. It uses Gradle, which in practice means to have Android Studio to be installed. But at least, one should be able to create AAB files with a script, without having to start the IDE, load the project, etc.

   https://developer.android.com/studio/build/building-cmdline

I am guessing that jmpessoa used the above guidelines to implement the same thing within LAMW.

And in addition to the above, if anyone has any suggestions, or examples of scripts they are using for building AAB files, I think that many people here, myself included, will appreciated it very much!
manlio mazzon gmail

neuro

  • New Member
  • *
  • Posts: 26
Re: LAMW + Android App Bundles
« Reply #4 on: July 30, 2021, 02:52:06 pm »
Unfortunately AAB building does not work (I am using Windows version of Lazarus).
When using the menu
Lazarus IDE --> "Tools"  --> "[LAMW]...." --> "Build Release......."
it creates “aab” file inside directory “\build\outputs\bundle\debug”,
however fails to create directory “\build\outputs\bundle\release”.
It launches batch commands inside “cmd” window, and at the end of batch processing it writes with red letters “BUILD FAILED” and then “cmd” window instantly disappears, so I am even unable to investigate what caused the error.
My question is: where are located *.bat files which produce AAB file? I need to fix these files which produce AAB file.
I suspect that these batch files use wrong directory/file names, and I need to fix that. The main problem of LAMW is that it creates *.bat files which use absolute paths instead of relative paths. When you move your project to another directory or rename project directory, all *.bat files stop working and you need to fix manually each *.bat file. This is inconvenient. It would be much better if generated *.bat files would contain relative paths instead of absolutes paths.
« Last Edit: July 30, 2021, 10:55:07 pm by neuro »

jmpessoa

  • Hero Member
  • *****
  • Posts: 1945
Re: LAMW + Android App Bundles
« Reply #5 on: July 30, 2021, 09:13:27 pm »
Quote
where are located *.bat files which produce AAB file? I need to fix these files which produce AAB file.

Project folder: "gradle-local-build-bundle.bat"    [and "gradle-local-build-bundle.sh"]
« Last Edit: July 30, 2021, 09:17:30 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

neuro

  • New Member
  • *
  • Posts: 26
Re: LAMW + Android App Bundles
« Reply #6 on: July 30, 2021, 10:49:37 pm »
File “gradle-local-build-bundle.bat” contains only the following lines:
Quote
set Path=%PATH%;C:\Users\Username\AppData\Local\Android\Sdk\platform-tools
set GRADLE_HOME=C:\fpcupdeluxe\ccr\lamw-gradle\gradle-6.8.3\
set PATH=%PATH%;%GRADLE_HOME%\bin
gradle clean bundle –info

Where are all arguments/parameters located for this gradle job? Where are located gradle settings for filenames, directory names, etc? I need to fix these settings, because it fails to create AAB file, it fails to create “\build\outputs\bundle\release” directory.
« Last Edit: July 30, 2021, 10:54:42 pm by neuro »

jmpessoa

  • Hero Member
  • *****
  • Posts: 1945
Re: LAMW + Android App Bundles
« Reply #7 on: July 30, 2021, 11:11:03 pm »
Quote
arguments/parameters located for this gradle job....

Project folder:  "build.gradle"
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

neuro

  • New Member
  • *
  • Posts: 26
Re: LAMW + Android App Bundles
« Reply #8 on: July 31, 2021, 12:04:36 am »
Running manually the file "gradle-local-build-bundle.bat" successfully produced AAB file in “\build\outputs\bundle\release” directory. I did not make any changes in any files.
I just run file "gradle-local-build-bundle.bat" and it successfully produced AAB file.
In “cmd” window in the end it wrote with green letters “BUILD SUCCESSFUL”.
I still have not tested this AAB for uploading to “Google Play”, so I do not know yet if this AAB file will be accepted, however the good news is that manually running file "gradle-local-build-bundle.bat" successfully produces AAB file.

However building AAB via Lazarus menu does not work. The menu
Lazarus IDE --> "Tools"  --> "[LAMW]...." --> "Build Release......."
fails to produce AAB file, and in “cmd” window results with red letters “BUILD FAILED”.
« Last Edit: July 31, 2021, 12:23:24 am by neuro »

 

TinyPortal © 2005-2018