Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.
like image 542
Himani Avatar asked Feb 29 '20 05:02

Himani


People also ask

Do I need Android studio for flutter?

It is not neccessary, but advised to install Android Studio for Flutter. It makes it very easy to install and configure all the settings etc. What you definitely need is the Android SDK and JDK. You can definitely install and run flutter without Android Studio (you can also use Visual Studio).

How do I import a project to flutter?

Step 1: Open the Android Studio and select Tools from the menu bar and click on SDK Manager. Step 2: In the newly open window click on the plugins and in the search bar search for Flutter and Dart and then install it. Step 4: Now after installing Flutter and Dart we are ready to import a Flutter project.


4 Answers

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!

like image 152
Christopher Kikoti Avatar answered Oct 19 '22 17:10

Christopher Kikoti


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.

like image 21
Derek K Avatar answered Oct 19 '22 18:10

Derek K


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

like image 8
Tariqul Avatar answered Oct 19 '22 16:10

Tariqul


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.

like image 5
Oprimus Avatar answered Oct 19 '22 17:10

Oprimus