flutter / flutter-intellij

Flutter Plugin for IntelliJ
https://flutter.dev/using-ide
BSD 3-Clause "New" or "Revised" License
1.97k stars 316 forks source link

Finished with error: Exception: Unable to locate gradle. Please install Android Studio. #1168

Open FrancoisBlavoet opened 7 years ago

FrancoisBlavoet commented 7 years ago

Steps to Reproduce

install flutter following the instruction on the getting started guide. Create my first flutter project

try to run it

~/code/flutterapps/myapp > flutter run                                                                                                                                                           <12:01:30>
Launching lib/main.dart on Nexus 6P in debug mode...
Unable to locate gradle. Please install Android Studio.

Version info

~/code/flutterapps/untitled > flutter doctor                                                                                                                                                     <11:58:45>
[✓] Flutter (on Mac OS X 10.11.6 15G1510, locale en, channel alpha)
    • Flutter at /Users/francois/code/flutter
    • Framework revision d36e2f6191 (13 days ago), 2017-06-21 15:09:10 -0700
    • Engine revision b0dee695ec
    • Tools Dart version 1.24.0-dev.6.7

[✓] Android toolchain - develop for Android devices (Android SDK 25.0.3)
    • Android SDK at /Users/francois/Developer/android-sdk
    • Platform android-25, build-tools 25.0.3
    • ANDROID_HOME = /Users/francois/Developer/android-sdk
    • Java binary at: /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 1.8.0_66-b17)

[-] iOS toolchain - develop for iOS devices (Xcode 8.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 8.2.1, Build version 8C1002
    ✗ libimobiledevice and ideviceinstaller are not installed or require updating. To update, run:
        brew update
        brew uninstall --ignore-dependencies libimobiledevice
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    ✗ ios-deploy not installed. To install:
        brew update
        brew install ios-deploy
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
        For more info, see https://flutter.io/platform-plugins
      To install:
        brew update
        brew install cocoapods
        pod setup

[✗] Android Studio (not installed)
    • Android Studio not found. Download from https://developer.android.com/studio/index.html
      (or visit https://flutter.io/setup/#android-setup for detailed instructions).

[✓] IntelliJ IDEA Community Edition (version 2017.1.4)
    • Flutter plugin version 15.0
    • Dart plugin version 171.4694.29

[✓] Connected devices
    • Nexus 6P • CVH7N15B04004491 • android-arm • Android 8.0.0 (API 26)

Note : I have 3 different versions of Android Studio installed : 2.3 stable, 2.4 alpha 7, 3.0 alpha 5

devoncarew commented 7 years ago

@Teovald, we may need to update the code that tries to auto-locate android studio; we look in a few common platform specific locations. In the meantime, you can fix likely fix the issue by running flutter config --android-studio-dir <path/to/android/studio>.

@mit, we should update our getting started docs for this

FrancoisBlavoet commented 7 years ago

Hi @devoncarew, thanks for the quick answer !

Switching to the alpha branch of flutter solved the issue : ultimately it sounds like I don't need to use AS (another issue is that I don't see flutter in the list of plugins I can install for any version of Android Studio), I just needed the gradle wrapper and the last versions of flutter have switched to it.

On my end, AS is installed in /Applications/Android Studio 2.3.app . I guess if you only look for Android Studio.app, you are not going to find it.
IMO this kind of setup is probably fairly common : many android devs have several AS versions installed at the same time.