Android Studio : Open Android Module in Android Studio option is missing in flutter project - android

I am developing a flutter app for both iOS and Android. When generating the APK, I prefer to use Android studio (my default IDE is VSCODE). However, when I go to Tools > Flutter I do not see Open Android Module in Android Studio option. I do see Open iOS Module in Xcode.
I followed couple of SO answers, even tried replacing android.iml file from a working project. Nothing happened. I re-cloned my project from BitBucket because sometimes the Android Studio was fine when the project is freshly from repo, but this time, that didn't work either.
I Also tried opening the gradle file and looking for the option (as explained in one SO answer), that didn't work too.
However I noticed, few issues.
In the folder structure, the root folder is replaced by the flutter icon. in projects where I have no issues with, the folder icon is folder.
In here I see .dart_tool folder. In working apps with no issue, I do not see this folder.
I do not have an android.iml file. In other projects I did.
Below is my folder structure in a nutshell. Whats going on here and how to fix this issue?

When you don't see any options to
open module in android studio
because of missing .iml files caused by .gitignore file, follow simple steps.
Click on File and choose Open..
Now in the opened dialog choose android folder of example flutter project under your plugin module. For e.g if test is your plugin with example as it's app then you need to select and click Ok
test\example\android
3. Then wait for Android Studio to sync and download necessary jar files.

Simplest solution
Open flutter project
Go to android folder
open manfiest file
On the top right you will see option open module in android studio
click on this option
Solution 2:-
Import your android project as a project in android studio

The easiest way is to use this command in the root directory of your project, it will create some missing files and it will definitely work.
flutter create --platforms=android .
Now just right click to Android folder

Related

Unable to add Spotify App Remote SDK library to Android Studio Chipmunk

EDIT: Added link to instructions
https://developer.spotify.com/documentation/android/quick-start/. I am at the section "Add the App Remote SDK".
I am following the step-by-step instructions provided by Spotify to add the App Remote SDK to my Android Studio project.
Their instructions state:
Unzip the App Remote SDK zip file that you downloaded. Add the library to your project by importing it as a module. In the “Project” side bar in Android Studio (View –> Tool Windows –> Project), right click your project’s root folder and navigate to “New” –> “Module”. In the “New Module” window, choose the option “Import .JAR/AAR Package”. Click “Next”.
With Android Studio Chipmunk, this option is no longer available.
I have tried numerous ways of importing the folder "android-sdk-0.7.2.-appremote-v1.2.3-auth" as a library into my Android Project. No matter how I do it, the Gradle Sync succeeds, but my code is not able to resolve any of the com.spotify.android imports. For example:
import com.spotify.android.appremote.api.ConnectionAparams;
Why am I having so much trouble importing a library into AS Chipmunk? I never had problems when using previous versions.
Is anyone else having this issue or just me?
TO fix this problem, I compiled the library into an AAR file. I copied the AAR file to the "libs" folder. Then added it as a module in the Gradle Build. Not sure why this works, but it does...

Android Studio cannot detect project structure of a flutter project

Initially, I was looking why I could not open the emulator window, then I found out that the main reason for that was that android studio cannot detect flutter project structure automatically, due to the missing ".iml" files and ".idea" folder, due to which it does not know the existence of two modules i.e my_project and my_project_android.
Can anyone help me? Why is this happening?
Note:- Android studio can detect flutter project structure just fine if I create a project from my computer only, but since I am importing a project from GitHub, it cannot detect the appropriate project structure.
Below is how my modules section in the project structure looks, everything section is completely empty here.
Edit 1:-
Following are the picks on trying to import project inside modules
Edit 2:-
This is from where I import project directly from android studio using "Get from Version Control" than,
After this, I just click on clone and no more settings are asked(or required).
I found out that the project I was getting from VCS was flawed, it had gradle files in the flutter root folder and some more problems, eventually, I created a new flutter project after that I copied dart and other files and also updated some android files, and it worked.

Android Studio: I can not run/debug my project after cloning it from my repository

My HD died two days ago, luckily my android app is versioned on Bitbucket. So I got an SSD, reinstalled Windows 10 and the latest Android Studio. With Android Studio installed, I've cloned the project of my app through the 'Checkout project from Version Control' option in the welcome window of Android Studio. The project seems to have been cloned correctly, bringing all my source codes.
However, Android Studio was not able to create a Run / Debug configuration automatically. So, I tried to create a configuration by my own by clicking Edit Configurations> Add New Configuration (green cross) and choosing the option Android App. When choosing this option, the error 'Error: Module not specified' is showing below in the window, like Shows the image I attached.
This is the first time I have to clone my Android project from my repository and unfortunately I am not sure how to handle it. Can anybody help me?
Looks like you are missing the settings.gradle file. Create a new one in the project root folder with the following content:
include ':app'
include ':BaseGameUtils'
include ':squarecamera'
include ':volley'
I just guessed your modules, fix them in case they are not correct.

How to create an Android Studio project from a subdirectory in a github repo

I need to create an android studio project from this directory on github. I tried VCS -> Checkout from Version Control in Android Studio, but there is no url for this directory in the repo, so I'm not sure hot to clone just this subdirectory.
I also tried downloading the whole repo, doing File -> New -> Import Project in Android Studio, and selecting the messaging subdirectory as the folder to import. This showed a build progress bar, but after it finished, there was no imported project.
How do I do this?
I am not sure if its the correct way, but i resolved it with the following steps on Android Studio 4.1.1 :
Run Android Studio until the Welcome to Android Studio screen shows up.
Select Get from Version Control.
Paste the URL.
Press Clone button.
This will import the complete repository , but you won't be able to run the app yet (exactly as mentioned in your question) .
Now close and re open Android Studio
On welcome screen, select import Project (Gradle, Eclipse ADT, etc.)
Navigate to the folder where the project was downloaded and select the required Sub-folder
Press OK and let the Studio build your project.
I get it now. Go back to this. Then hit Download Zip and unzip it. In Android Studio go to File -> Open -> then to the quickstart-android-master and then down to messaging. Do NOT open quickstart-android-master go down to messaging and open that.
EDIT
Be aware you will have to follow these instructions to get the project to build and run.
Add google-services.json in android studio

How do I import/build this project?

I am not a dev, but have some dev experience. I have never used Android Studio before but I wanted to look at an example app. I picked one I am very interested in, but it gives me nothing but grief just trying to import it.
https://github.com/AltBeacon/android-beacon-library-reference
Notes:
I am using the latest version of Android Studio. (1.0.2). I have added in all the SDK files needed I think.
I have downloaded and un-zipped Gradle 2.2.1.
I am running Ubuntu 14.04.
I have dealt with Eclipse for Android previously and was able to
hack someone else's code to suit my needs and actually deploy an unsigned apk.
The readme/install directions at the github don't really help a noob
like me.
Install:
I have extracted the project from the Download Zip link.
For the actual import into Android Studio I choose "Open an Existing
Android Studio Project" - because it looks like one.
I then choose the root directory created by unzipping the zip file,
in this case it is named "android-beacon-library-reference-master".
But it seems to select the project's Gradle subfolder (/gradle) for the project! Which I'm quite certain is invalid. I cannot seem to get it to use the root
folder.
What am I missing? Or is this not the correct way to "import" this particular app? Is this app not compatible with AS 1.0.2?.
TIA!
In Android Studio, close any projects currently open. You should see the Welcome to Android Studio window.
1.Click Import Non-Android Studio project.
2.Locate the project you exported from Github, expand it, select the build.gradle file and click OK.
3.In the following dialog, leave Use gradle wrapper selected and click OK. (You do not need to specify the Gradle home.)
Android Studio properly updates the project structure and creates the appropriate Gradle build file.
Can you try "Import Project" instead "Open Project". Thanks.

Categories

Resources