Himani
Himani

Reputation: 459

Can't find Open for Editing in Android Studio

I'm new to flutter. I want to open (android)module of flutter to another window. But there's no option visible in java file or any other android file. check this image

here is my flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.7.8+hotfix.4, on Mac OS X 10.14.5 18F132, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[!] iOS tools - develop for iOS devices
 ✗ libimobiledevice and ideviceinstaller are not installed. To install with Brew, run:
    brew update
    brew install --HEAD usbmuxd
    brew link usbmuxd
    brew install --HEAD libimobiledevice
    brew install ideviceinstaller
[✓] Android Studio (version 3.1)
[!] VS Code (version 1.42.1)
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (1 available)
! Doctor found issues in 2 categories.

Upvotes: 20

Views: 21776

Answers (11)

IBRAHIM ALI MUSAH
IBRAHIM ALI MUSAH

Reputation: 979

You should follow these steps in the Newer version of Android Studio starting from October 2024.

  • install FlutterX from the plugins section of Android Studio.
  • Open a terminal in the project directory
  • flutter clean to clean your flutter project.
  • flutter create . to recreate the missing iml files.
  • flutter pub get to get packages.

With this done, look at your status bar; you should see the Flutter logo in this image. Click on it and select Open Android Project.

FlutterX icon

FlutterX options

Upvotes: 0

Usama Baig
Usama Baig

Reputation: 41

Here's a solution that worked for me:

1- Close your current project in Android Studio.

2- Open the android directory of your project directly in Android Studio as a standalone project.

By doing this, the android directory is automatically opened in Open for Editing mode.

Note: The commonly suggested solution of creating a [project_name]_android.iml file did not work in my case.

Upvotes: 0

Mobians Developers
Mobians Developers

Reputation: 1

if you do not have option open for editing in android studio go to File > Open > select android folder and open it, it will open as android project then the Build app bundle(s)/APK(s) will be enabled in Build menu its the easiest answer

Upvotes: 0

Ayoub BOUMZEBRA
Ayoub BOUMZEBRA

Reputation: 5003

Go to File -> Open Then select the "android" folder inside your project, it loads like android module and works like a charm.

Upvotes: 1

Prodromos Sarakinou
Prodromos Sarakinou

Reputation: 921

You can always do it the simple way, File -> Open -> inside the project's folder, select android, and open it in a different window

Upvotes: 1

Md Tariqul Islam
Md Tariqul Islam

Reputation: 2804

create a file in android studio inside android name

[project_name]_android.iml

enter image description here

copy paste bellow code

<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
  <component name="NewModuleRootManager" inherit-compiler-output="true">
    <exclude-output />
    <content url="file://$MODULE_DIR$" />
    <orderEntry type="sourceFolder" forTests="false" />
    <orderEntry type="library" name="Dart SDK" level="project" />
  </component>
</module>

another solution: you can copy this file from another app and rename as like [project_name]_android.iml then paste in your project

Upvotes: 17

Christopher Kikoti
Christopher Kikoti

Reputation: 2703

Easiest tip that worked for me: Create new file under android, give it the following name:

[project_name]_android.iml

Leave it empty then re-try the option. Works like charm!

Upvotes: 36

Derek K
Derek K

Reputation: 3187

The problem is caused by missing .iml project files. These files are added automatically to the .gitignore file but they should not. To fix it:

  1. Delete .idea folder.
  2. Create a new temporary Flutter project with the same name.
  3. Copy from the project to your existing project these 2 missing files:
  • [project_name].iml
  • android/[project_name]_android.iml
  1. Open Android Studio and the problem should be gone.

To avoid it in the future, make sure .iml files are not excluded in the gitignore. There is a Github issue on this topic.

Upvotes: 39

Asaf Pinhassi
Asaf Pinhassi

Reputation: 15573

What happens when you right click on the Android folder -> flutter? Can you open the Android project from there?

This option has stopped working for me after I allowed Android Studio to generate Android project from the "Android project detected" popup suggestion.

I afraid it messed up something in Android Studio settings. I was able to fix it only after deleting all its settings. I guess there should be a more elegant solution.

Upvotes: 0

Oprimus
Oprimus

Reputation: 1898

Got to your project view on the left, then find the folder labeled "android" (it will have your current project name next to it in brackets). Right click, then navigate to Flutter > Open Android module in Android Studio.

Alternatively, if you open any file (e.g. build.gradle) in that "android" subdirectory, you will see Open for Editing in Android Studio at the top right. If you happened to click "hide" on this banner previously, simply restart the IDE. Source.

Upvotes: 6

CopsOnRoad
CopsOnRoad

Reputation: 267884

If you're not seeing that option, you can try this:

  1. Press cmd + shift + o and search for build.gradle file:

    enter image description here

  2. Once you open it, you'll see Open for Editing in Android Studio option at top right corner.

    enter image description here

Upvotes: -4

Related Questions