Flutter SDK not found exception
See original GitHub issueWhen trying to run a Flutter app from IntelliJ, got gradle build exception. Flutter plugin preferences point to /usr/local/google/home/eastrue/flutter for the SDK path. Plugin has not been updated in a while (but no prompt to update).
Console output below:
FAILURE: Build failed with an exception.
* Where:
Build file '/usr/local/google/home/eastrue/IdeaProjects/myfriendlychat/android/app/build.gradle' line: 11
* What went wrong:
A problem occurred evaluating project ':app'.
> Flutter SDK not found. Define location with flutter.sdk in the local.properties file.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error running gradle: Exit code 1 from: /usr/local/google/home/eastrue/android-studio/gradle/gradle-2.14.1/bin/gradle app:properties
FAILURE: Build failed with an exception.
* Where:
Build file '/usr/local/google/home/eastrue/IdeaProjects/myfriendlychat/android/app/build.gradle' line: 11
* What went wrong:
A problem occurred evaluating project ':app'.
> Flutter SDK not found. Define location with flutter.sdk in the local.properties file.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error running gradle: Exit code 1 from: /usr/local/google/home/eastrue/android-studio/gradle/gradle-2.14.1/bin/gradle app:properties
Launching lib/main.dart on Nexus 5X in debug mode...
Built build/app/outputs/apk/app-debug.apk (21.9MB).
Application finished.
Steps to Reproduce
- Create new project in IntelliJ IDEA Ultimate (have CE but can’t use it because IntelliJ always starts Ultimate).
- Click Run in the toolbar (for the MyApp default app).
Note that MyApp does build and run on the attached Android device.
Version info
[✓] Flutter (on Linux, channel master) • Flutter at /usr/local/google/home/eastrue/flutter • Framework revision c9a9c627b6 (13 days ago), 2017-03-16 18:04:14 • Engine revision 2937f06a15 • Tools Dart version 1.23.0-dev.9.0
[✓] Host Executable Compatibility • Downloaded executables execute on host
[✓] Android toolchain - develop for Android devices (Android SDK 25.0.2) • Android SDK at /usr/local/google/home/eastrue/Android/Sdk • Platform android-25, build-tools 25.0.2 • Java binary at: /usr/local/buildtools/java/jdk/bin/java • Java version: OpenJDK Runtime Environment (build 1.8.0_112-google-v7-150000077-147841663)
[✓] Android Studio (version 2.2) • Android Studio at /opt/android-studio-with-blaze-2.2 • Gradle version 2.14.1
[✓] Android Studio (version 2.2) • Android Studio at /usr/local/google/home/eastrue/android-studio • Gradle version 2.14.1
[✓] IntelliJ IDEA Ultimate Edition (version 2016.2) • Dart plugin version 162.2924 • Flutter plugin version 0.1.11.2
[✓] Connected devices • Nexus 5X • 0048fc9b7c76b7a2 • android-arm • Android 6.0.1 (API 23)
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
Looks like flutter/flutter#8365. It’s looking for
flutter.sdk
inandroid/local.properties
, which either doesn’t exist, or has been created by Studio, withoutflutter.sdk
.Flutter Tools will create local.properties on the first build, but only if it doesn’t exist. If Android Studio beats us to creating it, it won’t have a
flutter.sdk
entry, and we won’t add one.Workaround: Delete android/local.properties, and run
flutter build apk
. You should now be able to build and run from within Studio.This appears to be fixed - Flutter plugin 12.1. Feel free to verify and close. Woo hoo!