Android apk not being found anymore

Suddenly apk generated files are not being found during a successful gradle-runner step (version: 1.5.3):

ApkFileIncludeFilter: app-stage-release.apk
ApkFileExcludeFilter: *-unaligned.apk
MappingFileIncludeFilter: */mapping.txt
MappingFileExcludeFilter: 
DeployDir: /bitrise/deploy

BUILD SUCCESSFUL

Total time: 1 mins 38.999 secs

Move apk files...
  find "." "-path" "app-stage-release.apk" "!" "-path" "*-unaligned.apk"
No apk matched the filters

Move mapping files...
  find "." "-path" "*/mapping.txt" "!" "-path" ""
  No mapping file matched the filters

Any idea what could be going wrong?

1 Like

Hi @fmiralles,

Thanks for asking this question here!

Did you change your Gradle configs, related to the APK’s name? It seems that you did set a filter to only copy/deploy app-stage-release.apk, but this Gradle step no longer generates an APK with that file name.

If you want to copy/deploy a single APK, you have to specify the APK’s file name in the Gradle Runner step’s APK file include filter input/option (the APK’s file name which will be generated by the gradle task you specified for the Gradle Runner step).

If you want to copy/deploy all generated APK files, you can use a wildcard filter like: *.apk

Let us know if you’d have any questions!

It’s already specified. Check the pre-formatted attached lines…

That’s exactly what I meant, that you specified a filter app-stage-release.apk, but your Gradle task does not generate an APK with that file name (app-stage-release.apk).

You should check what’s the generated APK’s file name is, and set that as the include filter.

Checking btirise logs looks it’s the right name: /bitrise/src/app/build/outputs/apk/app-stage-release.apk
I did also check locally and it’s indeed the file being generated: app-stage-release.apk

Ohh, it might actually be related to the latest Gradle Runner version’s change: https://github.com/bitrise-io/steps-gradle-runner/releases/tag/1.5.3

Can you please try it with v1.5.2 of the Gradle Runner step?

OK, we found the issue and it’s indeed related to the new Gradle Runner step version. Fortunately the issue is really simple to fix: just add a * prefix to the filter.

E.g. instead of:

app-stage-release.apk

use:

*app-stage-release.apk

or

*/app-stage-release.apk

Basically the change was that the filter is no longer applied on the file name, but instead on the path, so if you specify an exact value without * then the full path have to match that. The advantage of the new filter method is that you can now filter by the path too, and not just by the apk’s name. E.g. previously this wasn’t possible: */apk/release/*.apk but now it is!

As you said it does works on Gradle v1.5.2.

Understood…

Thanks Viktor!

1 Like

We published a Changelog for this - you can find more info about how you can use v1.5.3

TL;DR; you just have to prefix the file name with * or */, as I mentioned above.

Me too i have react-native project and i want to build it android side “apk” i’m doing this workflow:

  • Activate SSH key. :white_check_mark:
  • Git Clone Repository. checked
  • Run npm commande (npm install). :white_check_mark:
  • Run npm commande (run “cd android && ./gradlew assembleRelease”) => to generate apk :white_check_mark:
  • Deploy to Bitrise Build :white_check_mark:
  • Firebase App Distribution :no_entry_sign:

    please i need help