Fixed: Invalid APK or AAB after gradle task failure

There have been two recent conditions that have caused the app-builder execution to fail but the Scriptoria build script was not catching it and still copying APK and AAB files even though they were not complete and would fail to run or upload to Google Play. These two conditions are:

  1. Using GeckoView would use too much memory when linking the binary and there would be a “Java Heap Space” error in the logs.
  2. Using too many images (verse on image, video previews) would cause the AAPT2 process which resizes the images to stop running and there would be a “Idle daemon unexpectedly exit. This should not happen.” error in the logs.

If you have these issues, I have done the following to address them:

  1. I have added code to verify the APK and AAB so that there won’t be build that say they succeeded but actually produced bad files.
  2. To temporarily work around the first issue with GeckoView, I have added support for BUILD_JAVA_MAX_HEAP_SIZE publishing property that will increase the memory used during the build of the APK or AAB file.
  3. Increased the size of the VM that is used in builds to work around the second issue. This doubles the cost of EVERY build.

There is a small percentage of projects that need the extra memory (and only for the Android build step). I will be adding a way to increase the memory used by only product builds that need it. In the mean while, if you have a project with GeckoView, then add the BUILD_JAVA_MAX_HEAP_SIZE publishing property and set to 1.

Thanks,
Chris Hubbard