Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build-logic project clean uses different Gradle version #5

Closed
hrach opened this issue May 18, 2022 · 3 comments
Closed

Build-logic project clean uses different Gradle version #5

hrach opened this issue May 18, 2022 · 3 comments
Labels

Comments

@hrach
Copy link

hrach commented May 18, 2022

Hello, we are using patterns based on this repository and we have met weird issue when cleaning through Android studio.

It runs cleans for both projects and the build-logic project clean fail with error resulting from the fact it uses some older Gradle version.

Currently, it is a Using dependency catalogs requires the activation of the matching feature preview. error. Otherwise, building the app normally works.

Do you have any idea why a different Gradle version is used? Thank you.

@hrach
Copy link
Author

hrach commented May 18, 2022

The error is

Settings file 'D:\xxx\android\build-logic\settings.gradle.kts' line: 3

Using dependency catalogs requires the activation of the matching feature preview.
See the documentation at https://docs.gradle.org/7.1/userguide/platforms.html#sub:central-declaration-of-dependencies

So basically it seems that Gradle 7.1 is used instead of 7.4.2

@jjohannes
Copy link
Owner

Hi @hrach. That's a known issue, which I think is fixed in newer IntelliJ versions - I don't see it anymore in IDEA 2022.1.1.

Here, Android Studio treats the included build-logic build as a separate build. And since it is configured to look for the Wrapper in the build, it looks for the Wrapper in build-logic/gradle/wrapper/gradle-wrapper.properties. Since there is non, it falls back to the Gradle version packaged in Android Studio. Which happens to be 7.1 in your case.

There are two workarounds I know of to make it work in your Android Studio version:

  • Configure a Gradle installation in the Preferences. For that you would have to install 7.4.2 explicitly and point Android Studio at it (not a very nice solution if you use the wrapper).
  • Duplicate the gradle-wrapper.properties to the build-logic/gradle/wrapper/. I think it's enough to have the distributionUrl entry in the duplicate as that is the only thing the Ide looks at. I think that's the best solution until this is fixed, but you'll have to remember updating that copy each time you upgrade the Gradle version.

@hrach
Copy link
Author

hrach commented May 18, 2022

Oh, thanks a lot. ❤️ it didn't crossed my mind that this is an AS issue, I was searching Gradle issues only.

@hrach hrach closed this as completed May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants