After Flutter GIT project checkout, unable to run the project

4,894

Solution 1

It is an Android Studio issue. The IDE doesn't apply the flutter SDK location for every new project you clone. The workaround is to open the cloned project go to File>Settings(Ctrl+Alt+S). In 'Languages & Frameworks'>Flutter set the SDK path to your Flutter SDK location (e.g. C:\src\flutter). Once you apply the changes and run the 'Packages Get' command the cloned project is fully accessible and understood by Android Studio.

Solution 2

I've succeeded to run you project. When I've first open it showed me that it can't find the location for Dart SDK, once I've set the location of the flutter sdk as explained here:

Dart SDK is not configured

it automatically update the location of the Dart SDK, then I've had to run get dependencies, then it run.

Share:
4,894
Daksh Gargas
Author by

Daksh Gargas

"That if statement had something else afterwards. (Pun intended)" I miss working on swift. Loves to play with 0s and 1s. Prefers using enums.

Updated on December 06, 2022

Comments

  • Daksh Gargas
    Daksh Gargas over 1 year

    So I created a Flutter project in IntelliJ Idea Community Edition on machine A and then uploaded the whole project on GitHub. Now I cloned/checked out from GitHub in the same IDE on machine B, performed the following:

    • flutter packages get
    • flutter upgrade
    • Set up the dart path and all other prerequisites

    But, I am still unable to run the flutter project from IDE. I mean I can't even press the "Run" button.

    Unable to press the run button

    Where did I go wrong?

    You can try performing the same steps as I did. it if you want. Here's the Git repository code

    Edit I can run the same project via terminal.

    [Update] As requested by Günter Zöchbauer in the comment log, here's the logs for flutter doctor -v

    BoringFlutterProject$ flutter doctor -v
    [✓] Flutter (Channel dev, v0.5.8, on Linux, locale en_IN)
        • Flutter version 0.5.8 at /home/daksh/flutter
        • Framework revision e4b989bf3d (8 days ago), 2018-08-09 09:45:44 -0700
        • Engine revision 3777931801
        • Dart version 2.0.0-dev.69.5.flutter-eab492385c
    
    [✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
        • Android SDK at /home/daksh/Android/Sdk
        • Android NDK location not configured (optional; useful for native profiling support)
        • Platform android-27, build-tools 27.0.3
        • ANDROID_HOME = /home/daksh/Android/Sdk
        • Java binary at: /home/daksh/android-studio/jre/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
        • All Android licenses accepted.
    
    [✓] Android Studio (version 3.1)
        • Android Studio at /home/daksh/android-studio
        • Flutter plugin version 25.0.1
        • Dart plugin version 173.4700
        • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    
    [✓] IntelliJ IDEA Community Edition (version 2018.1)
        • IntelliJ at /home/daksh/Downloads/idea-IC-181.5281.24
        • Flutter plugin version 25.0.2
        • Dart plugin version 181.4892.1
    
    [✓] VS Code (version 1.26.0)
        • VS Code at /usr/share/code
        • Flutter extension version 2.17.1
    
    [!] Connected devices
        ! No devices available
    
    ! Doctor found issues in 1 category.
    

    I posted this question because I'm sure many of us will face the same problem, just like we used to face some issues in AndroidStudio back then