-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Getting rid of buildDir deprecation #146036
Comments
gradle docs refrences this issue here |
@bartekpacia fyi |
well i'm still tracking where is the issue but from what i see the buildDir will be removed soon in gradle 9 so it can cause other issues |
@AbdeMohlbi I think you have a mistake in the second snippet. Please try this: allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.layout.buildDirectory = '../build'
subprojects {
- rootProject.layout.buildDirectory= "${rootProject.layout.buildDirectory}/${project.name}"
+ project.layout.buildDirectory= "${rootProject.layout.buildDirectory}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.layout.buildDirectory
} Also I'd try
I think it has no impact. One problem is that the code mentioned is located in app's code, not in Flutter's code. It's quite simple though, so maybe we can add an automatic migration for it (similar to #122290 - see class |
i'll try right away thank you |
@bartekpacia still the same :
BUILD FAILED in 22s |
Ah, I think I know! Gimme 5 minutes |
@bartekpacia consider seeing this i yhink this why : |
Yes, |
'''We know this is a big change and want to give time for authors of major plugins to move away from its usage first. The switch from a File to a DirectoryProperty requires adaptations in build logic. The main impact is that you cannot use the property inside a String to expand it. Instead, you should leverage the dir and file methods to compute the location you want.''' |
based on :
now it's saying : A problem occurred evaluating root project 'android'.
|
I tried your sample above and got the same error. The below works for me: rootProject.layout.buildDirectory = file("../build")
subprojects {
project.layout.buildDirectory = file("${rootProject.buildDir}/${project.name}")
project.evaluationDependsOn(":app")
}
tasks.register("clean", Delete) {
delete rootProject.layout.buildDirectory
} |
ur still using buildDir in the third line ? i'm i right?
im getting that : Illegal char <:> at index 194: C:\Users\bougara computer\StudioProjects\open_food_facts\android\app\property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, C:\Users\bougara computer\StudioProjects\open_food_facts\build))\app\intermediates\flutter\debug\libs.jar |
You're right, sorry. Ugh. Try this: allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.layout.buildDirectory = file('../build')
subprojects {
def directory = "${rootProject.layout.buildDirectory.get().asFile}/${project.name}"
logger.quiet("directory is: $directory") // debugging
project.layout.buildDirectory = file(directory)
}
subprojects {
project.evaluationDependsOn(":app")
}
tasks.register("clean", Delete) {
delete rootProject.layout.buildDirectory
} See also: |
@bartekpacia |
@bartekpacia |
Seems like it's another Gradle deprecation. I'd guess that some Gradle plugin you depend on is causing that. Anyway the issue is resolved, so let me mark this issue as closed :-) Please create a new one if you have a reproducible example. |
Will this changes be applied in a future release of flutter ? |
If you mean the automatic migration I was talking about, then no, it won't be in the next stable Flutter release. Someone has to develop it first. However you can already use this code and not wait for any changes in Flutter. |
Ty very much brother i really appreciate it |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Use case
Currently, when using the flutter create command to initialize a new Flutter project, the generated Android build.gradle file looks something like that :
well now '.buildDir' is deprecated so an alternative solution may be using '.layout.buildDirectory' instead so it well be :
Proposal
when trying to do that android studio doesn't say anything but gradle is yelling this :
The text was updated successfully, but these errors were encountered: