How to resolve "Collecting gradle caches... Generate dependencies map... Gradle task failed, error: exit status 1, "

Hi there,

I’m extremely unknowledgeable about Gradle and Bitrise caching. All of the builds for my Android react-native app show this:

Collecting gradle caches...
 Generate dependencies map...
Gradle task failed, error: exit status 1, output: FAILURE: Build failed with an exception.
* Where:
Build file '/bitrise/src/srcgen/build.gradle' line: 5
* What went wrong:
A problem occurred evaluating root project 'srcgen'.
> Could not get unknown property 'envType' for object of type org.gradle.api.internal.plugins.DefaultExtraPropertiesExtension.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED in 1s
Done

The build of the APK works fine, it’s just this noise in the logs.

That srcgen/build.gradle file it’s running is just a utility that we occasionally run during development. We don’t need to automate anything about it on Bitrise.

How do I exclude it from whatever Gradle is doing here? I saw on this question that I could disable caching, but I’d rather not do that if I don’t need to.

Thanks!
Jeremy

Hey @jeremy.gale!

This should not affect the build(like you said), Bitrise caching works as the following:

  1. run dependencies tasks on all modules
  2. collect these outputs to a “lock” file
  3. cache gradle files only if this “lock” file is changed.

The above is intended to fix the issue when you have a valid cache and you add a new dependency to your project so it won’t cache the new dependency.

It is not an issue or error btw, it is a warning message and printed only to inform you that there was an issue with collecting gradle caches, so if the caching doesn’t works as intended then you can find out where and what causes it.

In case of the above, do you have a suggestion to improve it, so next time this could be more straight forward?

Btw, thanks for opening a thread for this! :slight_smile:

1 Like

Oh really? It sure makes it sound like it’s an error with the all caps BUILD FAILED and everything. (Though I have been ignoring it until now because I’ve been getting the APKs Iw ant).

Just thinking out loud here for suggestions, feel free to ignore if these make no sense:

  • Allow you exclude certain paths for scanning for Gradle files
  • Make it more of a WARNING: Could not build ____ so caching won’t work for that project

Something along those lines?

Thanks for the reply!
Jeremy

2 Likes

This design is intended to avoid the need to run multiple builds and debug for hours to finally figure out if there is any issue with the caching. I understand with you it should be more eye-friendly, however this is the only way I could do it to be able to fix issues the fastest possible. If this log is there, that doesn’t mean cache won’t work but some dependencies maybe.

I leave this discussion open, and I like your ideas btw, however we’ll need to keep somehow the verboseness of the log for this cases. :+1:

1 Like