Gradle 5.1.1 Bug

android
(Andrew Fung) #1

I have a simple Android app developed in Android studio. When I built it with Gradle 4.10.1, there was no warning or error. When I updated Gradle to Version 5.1.1, I got the following warning:

Task :app:processDebugResources UP-TO-DATE
Changing the value for a property with a final value has been deprecated. This will fail with an error in Gradle 6.0.

Can anybody help? Thank you in advance.

(LingoCoder) #2

It’s just a warning. Not a „bug“. So there’s nothing to worry about :slight_smile: Your build didn’t fail because of it. Right? Or did it?

The current Gradle release is 5.4.1. Judging by their apparent release schedule, you’ve got more than a year before version 6 is out.

That’s plenty of time for you to refactor your build script to whatever the warning is nudging you to refactor. Isn’t it?

(Andrew Fung) #3

Here is more details about the issue:
Task :app:processDebugResources UP-TO-DATE Changing the value for a property with a final value has been deprecated. This will fail with an error in Gradle 6.0.

The problem is: I have no idea what needs to be done to the Gradle scripts. I suspect the warning came from codes not controlled by me. That’s why I call it a “bug”.

(LingoCoder) #4

We’d need more details to be able to know what exactly is causing your warning. Please, can you run this command?

gradle -i -Dconsole=verbose --scan :app:processDebugResources 

When it asks for your permission to share the scan, answer yes (if you are OK with sharing). Then share with us the URL it outputs for you?

Thanks in advance.

(Andrew Fung) #5

Thanks for your suggestion. My build scan is published below:
https://gradle.com/s/6gh4ggk3wao2e

Thank you.

(LingoCoder) #6

Thanks. I’m sorry. I need to ask you to run it one more time. Please? Like this this time:

gradle -i -Dconsole-verbose --warning-mode all --scan :app:processDebugResources 
(Andrew Fung) #7

Here is the new build scan:
https://gradle.com/s/if3du7kgphzr6

Thanks again for looking into it.

(LingoCoder) #8

You’re welcome :slight_smile:

As near as I can tell, going by the scans, something in the com.android.application plugin is to blame. My best guess would be probably somewhere around ProducersMap.kt:148:

...
at com.android.build.gradle.internal.scope.ProducersMap$Producer.resolve(ProducersMap.kt:148)
at com.android.build.gradle.internal.scope.ProducersMap$Producers.resolveAll(ProducersMap.kt:101)
at com.android.build.gradle.internal.scope.ProducersMap$Producers.resolveAllAndReturnLast(ProducersMap.kt:106)
at com.android.build.gradle.internal.scope.ProducersMap$Producers$injectable$1.transform(ProducersMap.kt:91)
at com.android.build.gradle.internal.scope.ProducersMap$Producers$injectable$1.transform(ProducersMap.kt:78)
...

The scans say you’re already using the most up-to-date Android plugin. So I don’t think there’s anything you can do about the warning. Except wait until Google refactors their plugin to align with Gradle 6.0.