Can't find Open for Editing in Android Studio
Asked Answered
P

8

20

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.
Pianette answered 29/2, 2020 at 5:37 Comment(4)
Not understand properly what you want.Babiche
I want "Open for editing in android studio" in flutter's android module like this: i.sstatic.net/g9p1F.pngPianette
Did you find a solution for this? I am really tired of this now.Equip
for window, just create new file(_android.iml) as below.path-> android/[project_name]_android.imlCatastrophism
O
39

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.

Oney answered 22/9, 2020 at 6:27 Comment(2)
For me, I just needed to create this file android/[project_name]_android.iml. I even left it empty.Forequarter
@Hasan El-Hefnawy's solution worked for meSuperload
R
36

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!

Romulus answered 28/6, 2021 at 15:30 Comment(1)
Simple, but very helpfulSayce
P
17

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

Pareto answered 30/8, 2021 at 16:9 Comment(1)
easy to follow steps. greatSisterinlaw
K
5

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.

Kirk answered 22/8, 2020 at 23:4 Comment(0)
J
1

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

Jacobina answered 22/12, 2021 at 12:28 Comment(0)
I
1

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

Indicant answered 29/4 at 14:54 Comment(0)
G
0

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.

Gypsie answered 24/8, 2020 at 4:20 Comment(0)
R
-3

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

Racket answered 29/2, 2020 at 14:56 Comment(1)
No, that's not happening unfortunately.Equip

© 2022 - 2024 — McMap. All rights reserved.