Add Android Run/Debug configuration for Flutter project - android

I am working with a Flutter example project where it shows how to share a FlutterView inside an Android application (and iOS also).
While working with it I tried this:
I make changes to the android project like changing the theme color, if I do hot-reload/run for main.dart I don't see the changes reflected in the running app. I have to stop it from Android Studio and run the main.dart again to see the changes.
To solve the issue I was thinking to add a run/debug configuration for Android app module. So that I could run android app and not main.dart.
Is there a way how to achieve this in Android Studio?
One solution for me was to open the android(/flutter_view/android/app) project from a new window in Android studio. I could run the app this way.
(But here I encountered another issue in case anyone has the solution).

According to my understanding you face problems when you open your project and try to run.
Android studio asks you to configure your project to be able to run...
It's easy to solve near to run button you will find "add configuration" button just press then from left side select "flutter" and put in the field "entrypoint" your main Dart file path main.dart...
EX. E:/project/lib/main.dart....
Then from top right corner press "create configuration"...
That's it.

For Configure your Flutter app on Android you have to Upgrade Gradle file..
So Go to the Tool and at you will find AGP upgrade Assistant..
It Download new Gradle file then its Config automatic..

Related

I can't find the Image Asset option in Android studio

I started learning App development in Android Studio, using the Flutter UI toolkit. Everything seems fine, however when i want to create a New Image Asset to edit my app's icon, i can't find it. When i right-click the android/app/src/main/res folder, it does not appear within New. I am following some older tutorials and they all have that option there.
This is what comes up:
My version of Android Studio is:
And my version of Flutter is: 2.8.1 (Dart 2.15.1)
How can i fix this, or are there any alternatives for modifying my app's icon?
Does it work for you? If that doesn't work, try right-clicking the drawable folder and selecting "New" -> "Image Asset".
Try to do the following:
Right click on res directory -> Choose Mark Directory as -> Resources root
If it is not working, try to change file view to Android:
I got it to come up when I right click on the root node of the project (a flutter project) and selected flutter -> Open Android module in Android Studio
Then I was able to right click the res folder and clicked on new -> Image Asset
Ah, I've seen this before as you're using Flutter. Despite all the answers, I'd recommend you to right-click the android/ folder from your Flutter app root and select Mark as... > Project Root, then close and reopen the project in Android Studio.
If Android finally recognizes this as an Android project, it will take a long, long time to download some of the project's dependencies (in which some of them are already downloaded through flutter pub get and flutter run/build. After it's ready, the project files will be finally available for you, including the option to launch the Image Asset Studio.
Update To Latest Version Frist.
Android Studio Dolphin | 2021.3.1 Patch 1
Visit https://developer.android.com/ And Download Manually And Install.
After You Can Find Res/New_resources_deirectory/midmap
It's Very Simple.
#Android_Studio
For Flutter users: If you created the Android project via flutter create, make sure to open the Android Studio project in the android subfolder, not the one in the root folder. Then, Android Studio should automatically run gradle. Once this has finished (which can take quite some time on the first run), the Android Studio UI should automatically switch to the "Android View", and the "New > Image Asset" option should become available for the res folder. No need to manually mark anything.
Just make sure that gradle runs through, otherwise the real "Android View" won't be available, even if it is selected.
I have faced same issue and this suggestion really helped me. Hope this will help you too.
https://stackoverflow.com/a/66773774/20910266
To me the key point is this:
"don't open the whole project of flutter using Android studio just open the android folder found inside the flutter project with Android studio, so the Android studio can treat it as a Android project rather than flutter project, which will give you all Android features like the one ur looking for #image asset studio".

how to start flutter project with android studio?

i wanted to start a flutter project but after i start android studio i get an different menu then what i saw (like here). and after that, when i start the flutter project, it is different too as you can see here. idk if it effects the outcome, but I dont know how to start a project right with these :(
here is new flutter project in the middle
then choose Flutter

Android side of a Flutter project showing error

I have a Flutter project where, all of a sudden, without me doing anything special as far as I can remember..the Android side has started to show an error, and I am totally lost, I have no idea at all of what is wrong or why that happened.
That is what I see when I open the android folder, the MainActivity on the flutter project on android studio:
I have tried calling flutter clean, restart/invalidate cache, gradle clean...and so far nothing works.
The weird thing is that the project actually runs in the emulator without any problem. And also, if I open the Android part independently on Android Studio i don't see any error.
Anyone had that before?
Android Studio version 3.3.1
Solutions of this answer do not work.
** ----- NOTE ----- **
The problem here can be (not sure at all maybe someone else can help here) that I am using a flutter package called ImagePicker, which after some code investigation, it turns out that it is using some AndrodX imports....and...as far as I am aware of...Flutter is not yet compatible with AndroidX.
But i need someone else to confirm that in order to post a solution.
This error is not really an error. This happens because android studio is set to read and edit dart not java. In order to edit the android side of a flutter project, you need to click on the android folder -> go to the flutter option -> click 'open in Android Studio'.
This will then allow you to edit the android side of your project.
Set Configure to the Android project SDK of flutter application
Step by Step
Click on File -> Project settings then select appropriate API level as per your project will solve your issue

how can I run hiero in android studio?

I have created a libgdx project using the installer from http://libgdx.badlogicgames.com/download.html and the Gradle extension for Android Studio.
Example for IntelliJ IDEA: Go to the Hiero class, right click and select Run Hiero.main(). On the Run >configurations popup that will appear, select the Desktop module, and click Run.
How do you do this under Android Studio?
I just found out the procedure. I leave the answer for those fellow beginners who may come across this problem like me:
go to structure tab beneath the project tab and the rest is the same as the above example for IntelliJ IDEA

How to run a project that is inside some subfolders on android studio

Please see the attached image for the project structure. Currently its the run button is greyed out. I know that I can from files open only the folder from where the android studio project starts but then version control will not work.
Right click on the MainActivity (or what ever name you use for your launching activity) and say Run. It will automatically setup the run configuration for you in Android Studio.

Categories

Resources