Android Studio not creating main.dart file - flutter

I'm new to programming so please be genetle. I'm handy with computers though and I've been sitting on this problem for a few weeks while learning flutter and dart
When I create a new flutter application in android studio, it does not create a main.dart file - the libs foder is empty, and I also see no IOS folder. In fact, what I see looks VERY different from any tutorials I've seen !!
What I do see is a bunh of .xml files, including one called activity main which runs a main activity function which almost seems like it is there instead of the main.dart file I'm looking for.
I have run flutter doctor, apparently everything is good.I have the dart and futter plugins installed. It is not a case of selecting "project" from the drop down menu instead of "Android" which is a common answer online. Not sure what I'm missing !!
Any help would be really really appreciated as I'm learning to code to open my next business and I am struggling to get over the first hurdle.... at leasr I am proficient wit dartpad now though :P
EDIT:
When I click on 'file > new > new flutter project', I don't see an option for "flutter application". This is what I see...
enter image description here
If I create a flutter project at this point, this is what Android Studio looks like for me...
enter image description here

If you have properly created a Flutter project in Android studio, main.dart file should be very easy to locate. It is located in project_name -> lib -> main.dart, as follows:

I am sharing steps to create flutter project in android studio :
Step 1: Open the IDE and select Start a new Flutter project.
Step 2: Select the Flutter Application as the project type. Then click Next.
Step 3: Verify the Flutter SDK path specifies the SDK’s location (select Install SDK… if the text field is blank).
Step 4: Enter a project name (for example, myapp). Then click Next.
Step 5: Click Finish.
Step 6: Wait for Android Studio to install the SDK and create the project.
Note: When creating a new Flutter app, some Flutter IDE plugins ask for a company domain name in reverse order, something like com.example. The company domain name and project name are used together as the package name for Android (the Bundle ID for iOS) when the app is released. If you think that the app might be released, it’s better to specify the package name now. The package name can’t be changed once the app is released, so make the name unique.
The above steps create a Flutter project directory called flutter_app that contains a simple demo app that uses Material Components.
Running the application:
Follow the below steps to run the flutter application that was structured above:
Step 1: Locate the main Android Studio toolbar:
Step 2: In the target selector, select an Android device for running the app. If none are listed as available, select Tools> Android > AVD Manager and create one there. For details, see Managing AVDs.
Step 3: Click the run icon in the toolbar, or invoke the menu item Run > Run.
After the app build completes, you’ll see the starter app on your device.

as per screen shot shared by you click on flutter , hopefully this will create a new flutter project.

Related

How do I access the "New Module" option in Android Studio?

I'm attempting to follow these instructions to integrate the Bolt Mobile SDK into my Flutter project, where step 5a is, after opening my project in Android Studio:
Click File, select New, then select New Module.
However, I do not appear to have any such option:
Is there something I need to do to enable it? Was it moved somewhere else, or merged into another option (Import Module doesn't seem to cover it)? The Android web site confirms that it should be there, and that page was last updated 8 days ago as of this writing.
If you are trying to access the module into the main project than follow the instructions:
Move the module in your project directory.
Suppose if your module name is - library
In setting.gradle file add this lines
include ':library'
In build.gradle file, inside the dependencies block add this lines
implementation project (':library')
.........................................
Happy coding :)
Follow the instructions on image
After that you will find multiple options, go to new and then at the top you will find New Module option. From there you can create new module or you can import, do as per your requirement.
Happy coding :)
I give a solution for this issue,
Just follow my steps :
Step 1
Step 2
Step 3
Feel free to ask if any problem comes.
Happy coding :)
I think you have to check your flutter sdk set up because when you set up your flutter sdk it will be added automatically.
And If you done this.
Then check that did you add flutter plugin into android studio ? If not then follow this step.
Go to setings
Then search plugin
then search flutter into plugin
section.
Then click on install on install button into flutter plugin
Then restart your android studio
I hope this problem will be solved because this is probable solution for this problem .
Thank you .

How do I create an Android App Bundle using Android Studio, command line (first steps from Android instructions don't work, not fully explained)?

Hello and thanks for helping me solve my problem! I ask for an easier way, as I am trying to figure it out without success in this tutorial https://developer.android.com/guide/app-bundle. So far, I only worked with the Google Play Console itself, did not create an application in a third-party service. I first tried to download the Android App Bundle using Android Studio as described in this article https://medium.com/androiddevelopers/building-your-first-app-bundle-bbcd228bf631, but the first step describes pressing buttons that are not on Android Studio Panel "In Android Studio, select“ Build => Generate Signed Bundle / APK ”and follow the dialog." I do not see the options I need in the Android Studio panel (I attach a screenshot)enter image description here
, where do I need to click to create an Android App Bundle? Then I tried to create the Android App Bundle from this tutorial using the command line https://developer.android.com/studio/build/building-cmdline, I installed Grable manually as described in this tutorial https://docs.gradle.org/current/userguide/installation.html#installation unpacked and configured the system environment, as well as installed and unpacked JDK 17 for Windows/x64 (also on disk C but in a different non-Grable folder), but verifying the Grable installation when typing gradle -v in Windows PowerShell throws an error, and these instructions https://docs.gradle.org/current/userguide/troubleshooting.html#sec:troubleshooting_installation does not offer a solution what is displayed in my Windows PowerShell enter image description here
(The sentence highlighted in red from the screenshot in English looks like this "grable: The name grable is not recognized as the name of a cmdlet, function, script file or executable program. Check the spelling of the name, as well as the presence and correctness of the path, and then try again."), and when I enter gradle -v into the command line, it says "Grable is not an internal or external command, an executable program or a batch file.", I face the same problem if I enter into command line ./gradlew bundleRelease as suggested in this tutorial https://medium.com/androiddevelopers/building-your-first-app-bundle-bbcd228bf631. I'm stumped, what am I doing wrong, and what method is easier for me to create an Android App Bundle? Thanks again for the help in solving my problem and I apologize in advance if I have provided little information necessary to solve my problem.

Why app overriding after installing in android?

I build an app using flutter. For example name is ForSaudi. I wanted to copy the same app and which name should be ForJordon.
So ForSaudi is already installed in my mobile. Everything is good. Now I changed the name to ForJordon from AndroidManifest.xml file. After changing name and launcher icon, I installed the app into mobile, which is actually replaced with my previous app. It should not be replaced. Can someone guide me how can I do that? I would really appreciate.
Only changing name doesn't create new package. You also need to make changes in build.gradle and in your MainActivity.kt.
If you want a simple solution. Directly use this package
and run this command
flutter pub run change_app_package_name:main com.new.package.name

Getting Flutter doctor to work

How do I get flutter doctor on my Windows 10 laptop to work, please?
I followed the guidelines here,
Used git to clone the flutter repository,
git clone -b alpha https://github.com/flutter/flutter.git,
Tried adding "C:\Users\<user>\flutter\bin" to my path in the Control Panel
and then in an Admin Powershell, tried executing flutter doctor.
At first, it just hung.
After googling for help, I tried deleting the contents of the
C:\Users\<user>\flutter\bin\cache folder and re-executing flutter doctor but to no avail.
Then, I tried deleting all of flutter and cloning again but flutter doctor just hung again but with, Updating flutter tool.
Tried a few different Googled PATH-adding ideas (that seems to be a complex and disputed area.)
Got a new message: Waiting for another flutter command to release the startuplock
The latest state is that flutter doctor still just hangs but without any message.
I suspect the problem lies in the new Path not being properly recognised (in the registers??)
Can anyone help please?
Well, the issue is not clear enough, but this might be solution, if your flutter doctor is stuck, it might be due to Background Intelligent Transfer Service is disabled, in order to check for yourself, do the following:
Click on the start menu, and then start typing services.
Launch the services and look for Background Intelligent Transfer Service and make sure it is running.
At this stage I believe you will find it disabled for some reason, just right click on it and go to properties and start the service, also change the startup type to automatic.
I can not think of other reasons that might prevent flutter doctor to run for the first time on a Windows machine other than that honestly.
I know this question is a little bit old. Here is a solution that worked for me. Run the Command Prompt as an admin solved the issue for me.
For Windows user check to see if the unzipped flutter folder is read only. (i.e right click the folder then properties then in the attributes section untick the readonly property then apply this change to the folder along with the sub-folders then ok and thats it. Worked for me.
Some errors I got and how I fixed it:
(ERROR 1):
[flutter] flutter doctor -v 'crumb' is not recognized as an internal or external command, operable program or batch file.
Error: Unable to find git in your PATH. exit code 1
(Fix) - Go to flutter installation folder and inside flutter/bin edit the flutter.bat file using a text editor and remove the line (20) that says:
IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path%
The code should look like this on those lines:
REM If available, add location of bundled mingit to PATH
SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd
Save and Run flutter doctor and everything should work fine.
(ERROR 2):
flutter doctor takes too long
(Fix) - I downloaded the previous version of the sdk it worked like a charm.
(ERROR 3):
Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to resolve this.
(Fix):
Open Android Studio
Tools Menu, SDK Manager
In the window that comes up there are inner panels, choose SDK Tools panel
Tick Android SDK Command-line Tools
Choose Apply button near the bottom of the window
This worked.
(ERROR 4):
The term 'flutter' is not recognized as the name of a cmdlet, function, script file, or operable program.
(Fix) - Put the correct part in the env variables. I had put D:\flutter instead of D:\flutter\bin. That worked.
I got a solution that worked for me
initially i had downloaded the 2.2.5 SDK which gave the forever run error so i went back and downloaded the previous version ie 2.2.2 it worked like a charm
The Flutter SDK is installed in a protected folder and may not function correctly. Please move the SDK to a location that is user-writable without Administration permissions and restart.

Build and run Disabled in xcode

There are some applications which shows Build and run icon disabled which stops me from running the application.It does not happen to all applications but on a few . It mainly occurs to me in facebook applications and a few more applications.Can anybody have an idea what could be the problem ? I have tried everything from changing the build settings etc. but it does not work.
Need to fix the executable, it happens after renaming project.
Product > Scheme > Edit scheme..
Select
Run > Info
Set Executable is your app name, if selected None.
Try this, It's work for me.
Follow below steps to unable Build and Run in xcode
1) Go to
Product => Scheme => Edit scheme.
2) Select Run option and select info
3) In Executable if option is selected to None then change it to your app name
Hope this is help for some one.
That project appears to be the Sparrow audio project. It's not a stand-alone project you can run; it's a library, you need to be using it in another project to have anything to actually run.
The sparrow project includes a sample app called Scaffold which demonstrates the use of Sparrow. More info:
http://www.sparrow-framework.org/help/gettingstarted/
Also see:
http://www.sparrow-framework.org/help/documentation/
Note that you can still 'build'; it's just 'build and run' that can't be clicked.
I think those may be frameworks,static libraries. So the build and run option is disabled.
I think you might be creating plugin or frameworks or libraries (not an Application).
So the "Build & Run" icon is DISABLED.(as answered by Chandan Shetty SP)
In order to enable the icon you need to specify the Application which use this plugin or framework or library whatever you are building.
To specify such application:
Rt. Click on "Executables" (in Xcode's Groups and Files panel)
Select Add > New Custom Executable
Then specify the name of application (just for display purpose) and specify the path of the application.
Go to the Project menu in the menubar and change the Active Target to the target of the actual app.