'"APKs are not allowed for this application" when submitting an expo build to play store

I'm trying to submit a build to Google play internal testing but it fails with the error: Google Api Error: Invalid request - APKs are not allowed for this application

I am running the following commands:

eas build --profile development --platform android # works successfully
eas submit -p android

When running submit, Select a build from EAS doesn't work (returns Couldn't find any Android builds for this project on EAS servers. It looks like you haven't run 'eas build' yet.), so I provide the build ID from the build command. I have set buildType to app-bundle but it would still return the error. In the submit logs, I notice this:

skip_upload_apk | false

Can I change it to true and will that help? I have manually updated a build prior to running eas submit. Possibly related issue: during manual upload, it wasn't accepting the APK file as well, so I had to upload AAB.

eas.json

{
  "cli": {
    "version": ">= 0.37.0"
  },
  "build": {
    "development": {
      "releaseChannel": "default",
      "developmentClient": true,
      "distribution": "internal",
      "android": {
        "buildType": "app-bundle"
      },
      "env":  {
        ... // my env configs
      }
    },
    "preview": {
      "distribution": "internal"
    },
    "production": {}
  },
  "submit": {
    "production": {}
  }
}

app.json

{
  "expo": {
    "version": "0.0.5",
    "scheme": "myscheme",
    "web": {
      "favicon": "./assets/images/favicon.png"
    },
    "plugins": [
      "sentry-expo"
    ],
    "android": {
      "versionCode": 2
    }
  }
}


Solution 1:[1]

As of August 2021, the Play Store only allows new apps to upload AAB files. Old apps are grandfathered into allowing apks for a while. Short of a specific deal with Google (good luck with that), if you have a new app you will need to upload an aab instead.

Solution 2:[2]

Currently, your development build is building an apk that's only meant for internal distribution. Once you remove "distribution": "internal", that's nested under "development" and run the build process again, it'll create an .aab that you'll be able to submit to Play Store.

You can find more information at the Play Console Help Link

Solution 3:[3]

The eas.json within the root of your project file contains 3 different profile configurations. Development, Preview, or Production. These can be changed by issuing the following command:

eas build --profile production

The production profile doesn't contain the "distribution": "internal" configuration so it will submit the correct build App Store.

https://docs.expo.dev/build/automating-submissions/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gabe Sechan
Solution 2 nulltron
Solution 3 Rees McIvor