Search code examples
androidfirebasegradleandroid-app-bundlefirebase-app-distribution

Firebass App Disitrbution upload apk with gradle


My app consists of two dynamic modules and instant app. I'm using app bundle to upload my production builds to the Play Store. When I'm trying to upload apk to the Firebase App Distribution, I use command:

./gradlew assembleVariantRelease appDistributionUploadVariantRelease

Unfortunately, app uploaded in this way results in a crash, and the stacktrace tells me that there are some classes from dynamic modules, that are missing.

The solution I found was to use bundletool and extract universal.apk from it. It turns out, the apk extracted works great, has all the classes included for the app to work.

When I was using Fabric Beta to distribute app, I just needed to provide apk to /projectPath/app/build/outputs/apk/variant/release and run ./gradlew crashlyticsUploadDistributionVariantRelease for it to work. It uploaded working apk file as expected.

When I tried to do the same with Firebase App Distribution (providing the universal apk to the right folder then running ./gradlew appDistributionUploadVariantRelease without adding assembleVariantRelease first), it seems that the command not only uploads apk to the Firebase, but also overwrites my previous apk file by building a new one.

When I upload universal.apk to Firebase manually (via web console), it also works fine.

My question is: Is there a gradle command for Firebase App Distribution to only upload apk from specific folder without triggering a build of a new apk file?


Solution

  • Was just working on this, current firebase documentation is not improved yet so I decided to move to CLI, where you can point out apk path. In midway through, my friend asked about this in firebase-community slack and turns out you can point out apk by adding apkPath to app distribtuion block in gradle.

    P.S.: You can join community slack from here -> https://firebase.community/