Skip to content

"Missing ExternalProject for :" #168296

@rekire

Description

@rekire

Steps to reproduce

  1. Create an empty project e.g. via flutter create demo
  2. Open the android directory in Android Studio

Expected results

The Gradle project could be opened on Windows

Actual results

You get a strange Gradle error:

Missing ExternalProject for :

Related issue: https://youtrack.jetbrains.com/issue/IDEA-329756/Importing-symlinked-Gradle-included-build-fails#focus=Comments-27-11721320.0-0

Possible Fix:
rekire@335484e

  /// Escapes [path].
  ///
  /// On Windows it replaces all '\' with '\\'. On other platforms, it returns the
  /// path unchanged.
-  String escapePath(String path) => _platform.isWindows ? path.replaceAll(r'\', r'\\') : path;
+  String escapePath(String path) {
+    if (_platform.isWindows) {
+      final unified = path.replaceAll(r'\', r'\\');
+      // ensure that the drive letter is upper case see
+      // https://youtrack.jetbrains.com/issue/IDEA-329756/Importing-symlinked-Gradle-included-build-fails#focus=Comments-27-11721320.0-0
+      return unified[0].toUpperCase() + unified.substring(1);
+    } else {
+      return path;
+    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectfyi-toolFor the attention of Flutter Tool teamplatform-androidAndroid applications specificallyplatform-windowsBuilding on or for Windows specificallyr: fixedIssue is closed as already fixed in a newer versiont: gradle"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions