AppCenter Not Building Native Android APKs? Try this…

Posted: December 11, 2020 in Android, Software Development
Tags: , , , ,

So I recently ran into an issue where Microsoft AppCenter wouldn’t build my Android APK… It would find the source, build successfully, then fail to find the resulting APK.

If you’re running into this issue, try the following:

This is based on @johnclarete’s idea, which I had to modify due to it relying on Flutter’s config.

  1. Modify the build.gradle file in your Application folder as follows:

Find the android { part of the file and paste in the buildTypes part:

android {
    compileSdkVersion 30

    buildTypes {
        appcenter {
            applicationVariants.all { variant ->
                variant.outputs.all {
                    def currentFile = new File(outputFileName)
                    def filename = currentFile.getName()
                    outputFileName = "../../../../../Application/Application/build/outputs/apk/${filename}"
                }
            }
        }
    }
  1. In AppCenter, you should now have an “appcenter” Build Variant option.
image
  1. Disable Build Android App Bundle.

That worked for me. I hope this helps others.

Leave a comment