0

I’m currently facing a strange error when trying to build my Flutter app on macOS.
I’m using Flutter 2.10.5 (via FVM) because my project SDK constraint is:

environment:
 sdk: ">=2.12.0 <3.0.0"

Whenever I try to run the app (fvm flutter run), I get this error:

Launching lib/main.dart on Redmi Note 5 in debug mode...
e: file:///Users/babanla/development/flutter/packages/flutter_tools/gradle/src/main/kotlin/FlutterPlugin.kt:764:21 Unresolved reference: filePermissions
e: file:///Users/babanla/development/flutter/packages/flutter_tools/gradle/src/main/kotlin/FlutterPlugin.kt:765:25 Unresolved reference: user
e: file:///Users/babanla/development/flutter/packages/flutter_tools/gradle/src/main/kotlin/FlutterPlugin.kt:766:29 Unresolved reference: read
e: file:///Users/babanla/development/flutter/packages/flutter_tools/gradle/src/main/kotlin/FlutterPlugin.kt:767:29 Unresolved reference: write
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':gradle:compileKotlin'.
> Compilation error. See log for more details

✅ What I’ve tried

  • Deleted Gradle caches and build folders:

    rm -rf android/.gradle
    rm -rf android/build
    fvm flutter clean
    fvm flutter pub get
    
  • Verified Flutter version:

    Flutter 2.10.5 • Dart 2.16.2
    
  • Updated Gradle versions in android/build.gradle and gradle-wrapper.properties:

    // build.gradle
    classpath 'com.android.tools.build:gradle:4.1.0'
    
    # gradle-wrapper.properties
    distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
    
  • Reinstalled Flutter SDK with FVM (fvm remove 2.10.5fvm install 2.10.5).

Still, the error persists and appears to originate from Flutter’s internal Gradle Kotlin files.


💻 My environment

  • macOS (Sonoma 14.x)

  • Flutter 2.10.5 (via FVM)

  • Gradle 6.7

  • Android Gradle Plugin 4.1.0

  • Kotlin plugin (bundled with Flutter)


❓ My question

What could be causing these "Unresolved reference" errors in Flutter’s internal FlutterPlugin.kt file, and how can I properly reset or align my SDK and Gradle setup so that the project builds successfully again?


2
  • Can you share your pubspec.yaml file? Commented Nov 8 at 6:30
  • Im facing the same issue with 3.38.1 Commented 2 days ago

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.