Skip to content

Fresh flutter createed Android project has a Gradle warning on Android Studio Giraffe (Canary version) #122289

@bartekpacia

Description

@bartekpacia

Steps to Reproduce

  1. flutter create a new project with Android support.

  2. Open the Android project in Android Studio/IntellIJ

  3. Go to top-level build.gradle file and see warning with the clean Gradle task declaration:

    Screenshot 2023-03-09 at 1 31 42 PM

    Screenshot 2023-03-09 at 1 31 48 PM

Expected results:

No warnings.

Actual results:

The warning is present, which doesn't look good since the project has just been generated using the official tool.

Environment

$ flutter --version
Flutter 3.7.7 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 2ad6cd72c0 (19 hours ago) • 2023-03-08 09:41:59 -0800
Engine • revision 1837b5be5f
Tools • Dart 2.19.4 • DevTools 2.20.1

Fix

It's pretty simple. Replace:

task clean(type: Delete) {
    delete rootProject.buildDir
}

with:

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    found in release: 3.7Found to occur in 3.7found in release: 3.9Found to occur in 3.9has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versiont: gradle"flutter build" and "flutter run" on AndroidtoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions