Skip to content

Android build fails if environment contains global repositories defined via allProjects.repositories #174035

@Daess

Description

@Daess

Steps to reproduce

  1. Create a global init.gradle in GRADLE_HOME and declare some repos inside via allProjects (e.g. mavenLocal())
  2. Install Flutter 3.35.1
  3. Run "flutter create example"
  4. Mount created project and run "flutter build apk"

Actual results

Build results with an error provided in logs section.
The issue is similar to the ones described in #173207, #161882 and #144751.
The workaround with versions downgrade worked till Flutter 3.32.8 and in 3.35.1 it doesn't work anymore (due to the changes under the hood, I believe).

Logs

Logs
flutter build apk
Resolving dependencies... 
Downloading packages... 
  characters 1.4.0 (1.4.1 available)
  flutter_lints 5.0.0 (6.0.0 available)
  lints 5.1.1 (6.0.0 available)
  material_color_utilities 0.11.1 (0.13.0 available)
  meta 1.16.0 (1.17.0 available)
  test_api 0.7.6 (0.7.7 available)
Got dependencies!
6 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.

FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/xxx/Desktop/temp/example/android/settings.gradle.kts' line: 20

* What went wrong:
Error resolving plugin [id: 'dev.flutter.flutter-plugin-loader', version: '1.0.0']
> Build was configured to prefer settings repositories over project repositories but repository 'MavenLocal' was added by settings file 'settings.gradle.kts'

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 638ms
Running Gradle task 'assembleRelease'...                           766ms
Gradle task assembleRelease failed with exit code 1

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.35.1, on macOS 15.6 24G84 darwin-arm64, locale en-RU) [793ms]
    • Flutter version 3.35.1 on channel stable at /Users/xxx/fvm/versions/3.35.1
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 20f8274939 (5 days ago), 2025-08-14 10:53:09 -0700
    • Engine revision 1e9a811bf8
    • Dart version 3.9.0
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop,
      enable-android, enable-ios, cli-animations, enable-lldb-debugging

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1) [2.4s]
    • Android SDK at /Users/xxx/Library/Android/sdk
    • Emulator version 35.4.9.0 (build_id 13025442) (CL:N/A)
    • Platform android-35, build-tools 35.0.1
    • ANDROID_HOME = /Users/xxx/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/xxx/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [5.5s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [111ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2025.1) [110ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)

[✓] IntelliJ IDEA Ultimate Edition (version 2025.2) [109ms]
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 86.0.2
    • Dart plugin version 252.24322.5

[✓] VS Code (version 1.99.3) [8ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available) [7.9s]
    • iPhone 16 Pro (mobile) • D0F2A3F0-716F-4620-A79C-2C553A4520FE • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-18-5 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 15.6 24G84
      darwin-arm64
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome
      139.0.7258.128
    ! Error: Browsing on the local area network for iPhone (3). Ensure the device is unlocked and
      attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources [192ms]
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform-androidAndroid applications specificallyt: gradle"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamtoolAffects 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