I wanted also to understand more about this Android App Bundle. I'm sure that Erel will find the best method to integrate it in B4A but just to begin, I create a very little and temporary tool to generate *.aab files with B4J. This is my first B4J app, be indulgent please
It uses Gradle to build apks from B4A projects and also to produce Android App Bundle. It's just a test, if someone can improve it. For now, I tested just one simple project (the included sample) with just "core.jar" as dependency from the B4A Libraries.
To use it:
- First, we need Gradle binaries (what I used is the version 4.6:
https://downloads.gradle.org/distributions/gradle-4.6-bin.zip). I don't know if it is OK for another versions. This is the first time I played with Gradle too. Extract the file in one folder and then reference it in the B4J app.
- After, fill all fields: gradle version, android.jar location, B4A installation folder, B4a project file.
- Compile the B4A project (in B4A or click the button Compile with B4A, it uses B4ABuilder) to produce all java sources
- Click Compile with Gradle (to produce apks: debug and releases version) - It takes long times sometimes, gradle download all dependencies file (I don't know yet if one can optimize it... ). May be this step is not needed if you want just to produce App Bundle. Apks produced here is like normal Apks (I think, I tested and they work well)
- Click Create App Bundle to produce App Bundle (sorry, I have no time to test it in Play store yet)
This is not a complete tool but just a test and to show, may be it is possible... I did it rapidly, may be, there are many bugs too.
All file produced by this app are in the subfolder "GradleBuild" in the B4A Project Dir. Produced APKs and AAB ar in the folder: ".GradleBuild\build\outputs"
PS: I am a very newbie in b4j and I don't now yet how to use jshell well... Log data in the TextArea are scrambled, I don't know why??
See enclosed the B4J source file, the very sample B4A sample project and produced apk and aab file with the tool.
v0.4: Can compile now projects with b4xlibs (eg: X2 Example pack of
@Erel). Not yet for Projects with #AdditionalJar directives or AppCompat Project, etc... Many things that I don't understand well yet. To compile X2 Example pack, compile directly in B4A before to execute #CustomBuildAction directive of the Game class. V.04 needs the ArchiverPlusZip library of
@Informatix to handle *.b4xlibs