Flutter-intellij: Unable to run flutter from Android Studio- Entry point isn't within current project

Created on 1 Jun 2018  ·  39Comments  ·  Source: flutter/flutter-intellij

_From @Sahas on March 3, 2018 19:8_

I created a new project using flutter, added english_words package as mentioned in the quick app guide. As the package contents were not reflecting, I restarted the Android Studio. Before restarting, the flutter run was working properly. After restart, I'm facing the below issue.

image

_Copied from original issue: flutter/flutter#15111_

P1 bug platform-android-studio topic-debugging

Most helpful comment

I had this problem!
The way I fixed it was clicking: File -> Project Structure -> Module
And then add the root folder of the project, then it will detect that its a flutter app again, and then build and work again.

All 39 comments

_From @Hixie on May 31, 2018 17:44_

cc @devoncarew IDE bug

Thanks for the report - I'm not quite sure why this would be happening. Is there anything obvious different about the file paths for the project and the main.dart file?

You could try deleting that launch configuration and recreating one to see if the issue is with the specific launch config, and not w/ running that specific file.

What version of Android Studio are you using? Please attach a flutter doctor -v report.

Without additional information we're unfortunately not sure how to resolve this issue. We're going to close this bug for now, but please don't hesitate to comment on the bug if you have any more information for us; we're happy to reopen. Thanks for your contribution!

I've the same issue. What additional information should I give in order to have a fix?

Edit: I am unsure wheter it makes sense but I'd like to notice that I use Android Studio 3.0.1 on Windows 10 Home.

Edit 2: My flutter doctor -v report

[√] Flutter (Channel beta, v0.9.4, on Microsoft Windows [Version 10.0.17134.345], locale tr-TR)
    • Flutter version 0.9.4 at D:\Android\flutter
    • Framework revision f37c235c32 (3 weeks ago), 2018-09-25 17:45:40 -0400
    • Engine revision 74625aed32
    • Dart version 2.1.0-dev.5.0.flutter-a2eb050044

[√] Android toolchain - develop for Android devices (Android SDK 28.0.2)
    • Android SDK at D:\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.2
    • ANDROID_HOME = D:\Android\sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
    • All Android licenses accepted.

[√] Android Studio (version 3.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 23.2.1
    • Dart plugin version 171.4424
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)

[!] Connected devices
    ! No devices available

! Doctor found issues in 1 category.

Without additional information we're unfortunately not sure how to resolve this issue. We're going to close this bug for now, but please don't hesitate to comment on the bug if you have any more information for us; we're happy to reopen. Thanks for your contribution!

Aside @devoncarew : it looks to me like our bot is too aggressive and auto-closed this one again.

I had this problem!
The way I fixed it was clicking: File -> Project Structure -> Module
And then add the root folder of the project, then it will detect that its a flutter app again, and then build and work again.

@HPH92 This solved the problem for me, Thanks.

I had this problem!
The way I fixed it was clicking: File -> Project Structure -> Module
And then add the root folder of the project, then it will detect that its a flutter app again, and then build and work again.

Worked for me as well. Thanks

I had this problem!
The way I fixed it was clicking: File -> Project Structure -> Module
And then add the root folder of the project, then it will detect that its a flutter app again, and then build and work again.

I have the same problem
image

I tryed to do this, but I can´t find the Project Structure in File.
Untitled

my project is in D:\Desarrollo\Flutter\flutter_homework_01 but in android studio in project view is D:\Desarrollo\Flutter\flutter_homework_01\ android . before was OK (the first path) but now have ...\android.
I dont know what happen and how to fix it.

please help.

image

image

Same problem as @darthzulder. If I create a new Flutter project, the File -> Project Structure option is visible. In the Flutter project with issue, File -> Project Structure is not a listed option. Also, in the Tools menu, the Flutter is no longer a menu option, and the Flutter toolbar options are missing.

The followings steps helped me:

  1. In Android Studio click File > Sync Project With Gradle files.
  2. Open *.dart file and click "Enable Dart Support for this Project".

The followings steps helped me:

  1. In Android Studio click File > Sync Project With Gradle files.
  2. Open *.dart file and click "Enable Dart Support for this Project".

image

there is no File > Sync Project With Gradle files.

The followings steps helped me:

  1. In Android Studio click File > Sync Project With Gradle files.
  2. Open *.dart file and click "Enable Dart Support for this Project".

there is no File > Sync Project With Gradle files.

Try to import project via gradle again.

Latest releases of the Android Studio working bad with Flutter projects.
The debugger doesn't work, after re-opening project AS can't compile it.

There is a simple way, just upload your code to git, then clone, reopen project with androidstuio, It will work fine. no thanks

The followings steps helped me:

  1. In Android Studio click File > Sync Project With Gradle files.
  2. Open *.dart file and click "Enable Dart Support for this Project".

Works for me. Tks

I had this problem!
The way I fixed it was clicking: File -> Project Structure -> Module
And then add the root folder of the project, then it will detect that its a flutter app again, and then build and work again.

Right click on Project -> Select Open Module Settings or F4 ->
image
If any Exist there, delete and then add the root content folder -> Click Apply

then set Add/Edit App Configurations ->
image

Select Flutter Template> Select main.dart ->
image

Then Enable And set Dart SDK path.

Solved the issue

Hope it helps.

Thanks guys. All of you save my day

Thanks...! works like charm...!!!!!!

I am able to adjust the project based on the @HPH92 recommendation but every time I restart the app, it asks me to resolve the error. Finally, I reimported it with Gradle as @w3ggy recommends and it works!

File -> Project Structure -> Module

I have no Module in Project Structure =(

@praveenb Thanks!

I have same error in mac but cann't solve.Please help me someone.

I had this problem!
The way I fixed it was clicking: File -> Project Structure -> Module
And then add the root folder of the project, then it will detect that its a flutter app again, and then build and work again.

Where to find the root folder??

For me the solution was to delete the folder .idea/ that is located in the root folder of the flutter project.

Then i restarted Android Studio and everything was fine !

Im using Android Studio 4.1 Canary 1

was

This works fine

It didn't work permanently, just temporary... And it doesn't work again thou all is set but still showing "entypoint isn't within the current project"

In my case.

I just added the code after

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

For me the solution was to delete the folder .idea/ that is located in the root folder of the flutter project.

Then i restarted Android Studio and everything was fine !

Im using Android Studio 4.1 Canary 1

Thanks, man you saved my day

Deleting .idea filder inside flutter project helped me.

add

void main(){ runApp(MyApp());}

in your main.dart file // replace MyApp with your Class Name.

Deleting .idea filder inside flutter project helped me.

This helped. Thanks for sharing.

For me the solution was to delete the folder .idea/ that is located in the root folder of the flutter project.

Then i restarted Android Studio and everything was fine !

Im using Android Studio 4.1 Canary 1

This helped for me!

After trying several hours quite some strange things I read something more from here, tried it, and now it works. Still: What exactly brought my project back to right state and why it suddenly wasn't dart/flutter project anymore is to me mystery.

Re-selecting Dart entrypoint file (in the file selection dialog navigate again to main.dart) in the Run Configurations dialog solved the issue. Oddly enoug, old and new new paths were the same. Seems that somewhere some configuration got updated.
(Android Studio 4.0.2).

What worked for me:
(1) Uninstall android studio COMPLETELY and redownload android studio Beta 4.2 or higher, preferably.
(2)Do a custom installation and set the path to your flutter file on your c drive (c:).

Deleting .idea filder inside flutter project helped me.

This helped. Thank you!

Was this page helpful?
0 / 5 - 0 ratings