eas build creates tar.gz file instead of apk file

Hello there,

I am failing to get an apk build file even though I am following the steps as mentioned on the create your build page.
I have done a few things differently as I want to use notifee package (as per their recommendations) :
a) added plug in app.json : “plugins”: [“@notifee/react-native”]

b) npx expo run:android

c) manually edited android/build.gradle :
compileSdkVersion = Integer.parseInt(findProperty(‘android.compileSdkVersion’) ?: ‘33’)
targetSdkVersion = Integer.parseInt(findProperty(‘android.targetSdkVersion’) ?: ‘33’)

d) the eas.json file looks like below :
“build”: {
“development”: {
“developmentClient”: false,
“distribution”: “internal”,
“android”: {
“image”: “ubuntu-18.04-jdk-11-ndk-r19c”
}
},

The command used is eas build --profile development --platform android

Not sure why I am getting a tar.gz file instead of a apk file.

Hi @anuanu23,

You’ll have to set "developmentClient" to true for the build to produce a .apk. In the configuration you shared, it is set to false.

Hi @anuanu23

In addition to what Aman said:

You shouldn’t need to do this, and in fact I’d recommend against it unless you’re developing your own native code as part of the app or you’re trying to debug a build issue locally. It has the side effect of generating the native projects which basically switches you to the bare workflow. To switch back to the managed workflow, the main thing is to delete the android and ios directories, or alternatively you could add them to your .gitignore.

You can use BuildProperties for this.

@amanhimself Thanks but I am not trying to build a development build apk. Its an apk for trial/testing of the final app on devices.

@wodin , thanks but from what I understand, to use the notifee package (link https://notifee.app/react-native/docs/installation) pre building is required and hence i had to run npx expo run:android

From my limited experience using another package, adding a custom code doesn’t cause the eas to create tar.gz ? Would you be able to confirm this pls ?

Hi @anuanu23

No, the Notifee documentation is incorrect/misleading. It’s not required.

They link to the Expo “Adding custom native code” guide, which in the past implied that you should run npx expo prebuild, but it is not required, because the EAS Build servers automatically run it for you during the build process:

You are correct. My comments were not related to the .tar.gz creation. I’m surprised it did that at all. I’ve only ever seen that when building an iOS Simulator build.

Did you try changing "developmentClient" to true as Aman suggested? I suspect that is the real answer.

If you’re not sure what you should have in eas.json you can rename your current one and then run eas build:configure and it will generate the default one. The default one is probably what you want, although if you need to specify the "image" etc., then you can of course add that back in. But don’t change the "developmentClient" or "distribution" settings and you usually don’t need to change the "buildType" either. NOTE: I don’t believe you need to specify the "image" either. See below.

If you use the default eas.json and use the development profile for an Android build it should build a .apk file by default. Same with the preview profile. If you use the production profile it will build a .aab file.

Android builds

Profile Default build type
development apk
preview apk
production aab

EDIT: This info from the Notifee docs is out of date and misleading too:

You will have to use image as ubuntu-18.04-jdk-11-ndk-r19c or another image that has jdk 11 as in the following configuration.

As you can see in the “EAS Build server infrastructure” page pointed to by the Notifiee docs, the “default” image is ubuntu-20.04-jdk-11-ndk-r21e, which already contains JDK 11, so no need for you to specify the older ubuntu-18.04-jdk-11-ndk-r19c image.

@wodin , thanks, your clarification was very helpful. Based on that I tried to replicate the issue by creating a new expo project from scratch rather than figuring out what’s wrong with the existing set up . But this time it worked fine, I was able to get an apk file.

The only 2 things ( I think) I did differently this time were :
a) I ran pre build command npx expo prebuild instead of npx expo run:android. I made the changes to the sdk version values in android/build.gradle once the file was generated.
b) added the dev client package after I created an apk first without it, using the command npx expo install expo-dev-client

If I were to guess it must be the step a) where things would have gone wrong for me.

I am able to create a dev client apk as well as a normal app apk now.

Again, thanks for your help in getting me to the solution as well as to for helping me understand the build process a bit more . _ /\ _

1 Like

I think you’re mistaken :slight_smile:

Neither a, nor b should have had anything to do with creating a .tar.gz file instead of a .apk file.

npx expo prebuild is automatically run when you run npx expo run:android

The JavaScript code from expo-dev-client can’t work without the native code, so if you install it after building the APK then it won’t be able to work properly. You need to build the APK after installing expo-dev-client.

If I were you I would do this:

  • Create a new Expo app
  • Install the Notifee npm:
npm install @notifee/react-native
  • Install expo-dev-client and expo-build-properties:
npx expo install expo-dev-client expo-build-properties
  • Add the Notifee and Build Properties config plugins to app.json:
"plugins": [
  "@notifee/react-native",
  [
    "expo-build-properties",
    {
      "android": {
        "compileSdkVersion": 33,
        "targetSdkVersion": 33
      }
    }
  ]
]
  • Do not run npx expo prebuild. Do not run npx expo run:android.
  • Run eas build:configure
  • Do not make any changes to eas.json
  • Run eas build -p android --profile development

Then download the dev client and install it on your phone or emulator.

I think that will work for you.

1 Like

I’m having the exact same problem and I think @anuanu23 was having the same problem but something got lost in communication. We have an app on the bare workflow and I’m trying to create a preview build, not a development build, and it consistently creates a tar.gz instead of just an apk. The tarball has two files, release/app-release.apk and debug/app-debug.apk. This happens for both local builds and builds on eas servers.

It used to only create one apk, which made installing the build from eas servers easy since you could scan the QR code or share the url and install the build directly for testing. This is no longer the case though, since we have to manually untar and install the apk.

I’ve tried various configs in eas.json. I’ve tried manually setting android.buildType: "apk", I’ve tried setting android.gradleCommand: ":app:assembleRelease", I’ve tried leaving out the android key. Nothing seems to work to create only an apk. Is there something else that controls whether it creates both a release apk and a debug apk?

See this thread: