selva kumar
selva kumar

Reputation: 551

Error: Entrypoint isn't within the current project

Unable to run flutter from Android Studio not detecting flutter project its shows Error: Entry point isn't within the current project

Every time restart android studio same error message shows

enter image description here

Upvotes: 54

Views: 67709

Answers (19)

Code on the Rocks
Code on the Rocks

Reputation: 17784

If your iOS, Android, or lib folders are missing, it typically means something is wrong with your project structure.

To fix it, delete the .idea folder in the root of your project and then restart Android Studio.

Using a Mac, you can display the hidden .idea folder by pressing Command+Shift+Dot in Finder.

The .idea folder will be automatically regenerated, and everything will return where it belongs.

See this post for the original solution.

Upvotes: 10

Pablo Diego
Pablo Diego

Reputation: 116

I had this problem because I renamed the Flutter Project at VS Code and when I opened at Android Studio, the old name was coming from .idea files.

To solve, I closed Android Studio and I deleted the .idea directory.

Upvotes: 3

Muhammad Javed
Muhammad Javed

Reputation: 119

If you are facing the following issue in Android Studio

Error: Entrypoint isn't within the current project

Here is the solution for my case, Open File-> Project structure then select your project in module tab and also set dart sdk in dependencies tab.

enter image description here

Another Screenshot is here: enter image description here

Hopefully, you've resolve your issue by these steps.

Upvotes: 0

Panagiss
Panagiss

Reputation: 3740

For none of the provided solutions worked. What I had to do is save my work and then go File -> Manage IDE Settings -> Restore Default Settings...

This will reconfigure SDK paths (Android, Dart, Flutter). It may sound like a hustle but it works and it's not that difficult to configure the settings again with the current version of Android Studio. Using: Android Studio Flamingo | 2022.2.1 Patch

Upvotes: -2

Viraj Patel
Viraj Patel

Reputation: 2403

After updating from Dolphin to Android Studio Electric Eel I was getting this issue.

Below trick helped me to make my flutter project working again.

  • Switch to project mode if not.
  • Right click on project name.
  • Select Mark Directory as -> Sources Root

Upvotes: 35

Erick Pranata
Erick Pranata

Reputation: 101

I'm currently in Android Studio Electric Eel.

I've done all of the suggested solutions above, but nothing works.

Turns out the project is not detected as a Flutter project. So what I do to resolve this issue is to remove gradle-related files from the root folder:

  1. build.gradle
  2. gradlew
  3. gradlew.bat
  4. gradle/

Upvotes: 0

Will28
Will28

Reputation: 609

I have created 2 folders inside lib's folder for my *pages* and *widgets*. 
Getting the main.dart file back to the **lib folder** will do the trick

enter image description here

Upvotes: 1

Yusuf
Yusuf

Reputation: 939

enter image description here

Click Content Root Close Icon and Remove Android Folder.

Fix it to me.

Upvotes: 1

Paul
Paul

Reputation: 1865

You might need to update the Gradle version. Or change the minimum android SDK version.

Here is worked for me:

Update Gradle / minSdkVersion version

  1. Reopen the project but at the directory user/StudioProjects/yourFlutterApp/android. After it is opened it will load some packages (see right bottom), which will take some time.
  2. It will ask you to update the Gradle version (right-left corner) or go under File>Project Structure Project you can set a higher Gradle version and under Modules variables of your build
  3. Now you can sync your project with Gradle files

After configuration, you might need to restart your project with File>Invalid Caches/Restart....

Upvotes: 0

onur k
onur k

Reputation: 53

The .idea folder will also be deleted on Linux. When Andriod Studio opens, click terminal at the bottom in Android Studio. Then type remove -r .idea/ in the terminal and press enter. After deleting, close and restart Android Studio.

Upvotes: 1

Swaroop Maddu
Swaroop Maddu

Reputation: 4874

Delete the .idea folder inside the root of the flutter project and restart Android Studio.

Refer to this question: What is the .idea folder? and make your decision if it's safe or not to delete .idea folder.

Upvotes: 103

dipakbari4
dipakbari4

Reputation: 858

I faced the same issue today and tried other solutions here but it wasn't worked at all.

In my case I deleted three folders that is android, ios, and .idea from project directory, then restarted android studio and finally I gave this command in Android Studio's Terminal.flutter create . to create appropriate directories (i.e., android & ios).

Now it is working fine.

Note: Before deleting the android / ios directory please make a backup of these directories only if you previously gave native code in android / ios directory.

Hope this solution will helpful if others will not work.

Upvotes: 0

yehyatt
yehyatt

Reputation: 2404

For me my project was missing the pubspec.yaml file, it was deleted by mistake , instead of warning about the missing file , I got this error

enter image description here

Upvotes: 7

Mustafa Max
Mustafa Max

Reputation: 69

This problem happened to me

I solved it this way

Go to the Android Studio track

I have this way

C:\Users\mustafamaxL\.AndroidStudio4.0\system

Remove folder (caches)

Then, start Android Studio again

Upvotes: 3

Akash Anaghan
Akash Anaghan

Reputation: 451

1) make sure flutter and dart sdk paths are properly configured from

File-> Settings..->Languages and Frameworks as well as make sure Dart support is enabled for project module from Dart Option enter image description here

2) at the end select File->Invalid caches and restart

enter image description here

3) so after 2nd step you may get in File->Project Structure.. option from there Select Modules then just simply add only root folder path of your flutter project and repeat just above 2nd step for me this worked

Upvotes: 17

zia khan
zia khan

Reputation: 381

Try delete .idea folder inside project folder and Invalidate & Restart Android Studio.

Upvotes: 5

Shamim Shaikh
Shamim Shaikh

Reputation: 827

Click on File-> Project Structure -> Module then add root folder of your project then it will detect its a flutter app and then build and work

its work for me

Reference: https://github.com/flutter/flutter-intellij/issues/2307

Upvotes: 30

Rohit Survase
Rohit Survase

Reputation: 71

You can sync the files with Gradle, within the File menu.

Else You can re-include the files/project root folder inside the File Menu.

File -> Project Structure -> Module

And then add the root folder of the project(with + icon), then it will detect that it's a flutter app again, and then build and work again.

Upvotes: 5

Mazin Ibrahim
Mazin Ibrahim

Reputation: 7889

Syncing your project with gradle files will solve it:

enter image description here

Upvotes: 7

Related Questions