Error setting up flutter for the first time - android-studio

I am having an issue getting flutter doctor to set up or create flutter projects in Android studio. I get the following error when I try to run flutter doctor.
ProcessException: ProcessException: The system cannot find the file
specified.
Command:
C:\Users\Joshua\AppData\Local\Android\Sdk\tools\bin\sdkmanager.BAT --licenses
I already did the steps in this link:
How to accept licenses with flutter doctor?

Related

How to solve "target died before we could attach" message in Flutter console?

i am new to android app development, i just started learning flutter and there is so much information to take in , i downloaded a project from github to try and make sense out the things that i only read about online and when i run the app this is what i get :
Screenshot1
Screenshot2
in the red boxes you can see there is a lot of things saying " target died before we could attach " what exactly is this ? is it something to be concerned about ? i tried googling it to see if i find some information about em but i couldn't find anything useful , maybe i was searching it the wrong way ...
Update: After running the "flutter doctor" this is what i got :
C:\src\flutter\flutter>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.4, on Microsoft Windows [Version 10.0.19042.631], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[!] Android Studio (version 4.1.0)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.52.0)
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (1 available)
! Doctor found issues in 3 categories.
but i am sure that i have installed the flutter and dart plugin
I have no idea what causes this error but this is how I resolved mine.
Confirm that flutter doctor generates no errors.
Uninstall any versions of the application from your emulator.
flutter run
Now you should be okay.
From a console window that has the Flutter directory in the path, run the following command to see if there are any platform dependencies you need to complete the setup:
C:\src\flutter>flutter doctor
This command checks your environment and displays a report of the status of your Flutter installation. Check the output carefully for other software you might need to install or further tasks to perform
source here
# Edit
If the doctor command does not indicate an error, then try to create a new project and copy and paste the classes from the project you downloaded to your new project. Flutter need to download the Gradle, it may be some IDE bug that can be solved by creating a new project

FLUTTER ALREADY INSTALLED! but still shows "Flutter plugin not installed; this adds Flutter specific functionality"

FLUTTER and DART ALREADY INSTALLED! but still shows "Flutter plugin not installed; this adds Flutter specific functionality"
[!] Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] Connected device
Appreciate your helps.
Just run this in the command line
ln -s ~/Library/Application\ Support/Google/AndroidStudio4.1/plugins ~/Library/Application\ Support/AndroidStudio4.1
... it worked for me... sorry I have no explanation , I got it from this link in stack overflow ...
Flutter plugin not installed error;. When running flutter doctor (answer 40)! hope it works for you.
Try to run the following commands:
step 1 : run> flutter channel dev
step 2 : run> flutter channel updrade
step 3 : run > flutter config --android-studio-dir="E:\Android Studio"
at step2
PS C:\Users\Administrator\Desktop> flutter channel upgrade
Switching to flutter channel 'upgrade'...
This is not an official channel. For a list of available channels, try "flutter channel".
git: fatal: 'origin/upgrade' is not a commit and a branch 'upgrade' cannot be created from it
Switching channels failed with error code 128.
but it doesn't matter
when i try “flutter doctor” ,there are no issues.
thanks

Android Studio AndroidManifest not found after moving project

Recently, I moved my Android Studio Flutter project to another location in my computer by closing the project in Android Studio and then opening it in its new location. This was the error that appeared in my console when I try to run my project again.
What do I need to do?
Launching lib/main.dart on Pixel 3 XL in debug mode...
ERROR: dump failed because resource AndroidManifest.xml not found
Failed to extract manifest from APK: ProcessException: The command failed
Command: /Users/user/Library/Android/sdk/build-tools/29.0.3/aapt dump xmltree /Users/user/Desktop/Coding Projects/Work/Smart Weighing Scale/Mobile App/loadcell_app/build/app/outputs/apk/app.apk AndroidManifest.xml.
No application found for TargetPlatform.android_arm64.
Is your project missing an android/app/src/main/AndroidManifest.xml?
Consider running "flutter create ." to create one.
First of all check AndroidMainfest.xml in project's android folder then please try with flutter clean command in terminal (It's located at the bottom of Android Studio) and then flutter create .

Unable to run flutter project

I've installed flutter SDK and started a new sample project , but couldn't run it ,here is the logCat
I tried running it on both android studio and VsCode and got the exact same log message.
When I tied running flutter doctor command in terminal I got this error:-
I think the issue is in the Dart-SDK but I've downloaded it from the flutter page as well as from Dart documentation.
Here are my environment variables in path
C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\git-cmd.exe;C:\Windows\System32;C:\flutter\flutter\bin
Try putting flutter in C:\src (full path should be : C:\src\flutter\ )
You should also update your env variables in path to : C:\src\flutter\bin, do that also for Dart sdk, env variable should be : C:\src\flutter\bin\cache\dart-sdk\bin
After That go to command line and type flutter doctor.

<Flutter> emulator launched but not detected by android studio

I'm a beginner in Flutter and I've an emulator opened/powered on and android studio doesn't detect it.
Hence I can't run any program because "no device is running". I've tried installing 'Android emulator' in the SDK tools but android studio still cant detect it.
Android Studio device list shows "loading" and no devices connected. Thus, I opened emulator but I cannot run flutter on emulator on Android Studio. After 5 hours I found that the reason is the new Flutter version.
I solved with choose different version of Dart and Flutter!
You need to download 1.17.3 version. Quick download link: Dowloand Flutter SDK 1.17.3 Version
And switch Stable Channel & Dart: 2.8.4, this is important. Also, if you want, you can check all versions of Flutter SDK: Flutter Versions
On MacOS, just write terminal: flutter channel stable
Note: If this answer is not working for you, you can open android module of your flutter app in Android Studio. It can be helpful when you try to add Firebase skills.
I had same problem.
CMD: flutter devices
No devices detected.
CMD: device emulators
Device emulator-5554 is offline.
In Android virtual device manager, I cold boot emulator and it started working.
In a windows platform I did:
If you have ran flutter doctor and there is no issues and if you can run your flutter app in cmd or using VSCode:
Just try to open Android Studio or IntelliJ as administrator by right clicking on the icon. This may list down devices and solve your problem.
The reason may be you have cloned flutter repository or you don't have right permission in flutter installed directory.
Run flutter doctor command to check whats the problem.
In terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device.
Check your flutter plugin whether it is up to date.
And read this flutter run: No connected devices , You may find the solution.
For me (on a Mac) I had the Android SDK installed in a custom location so I needed to set the ANDROID_HOME environment variable. In the terminal you can check what this value is with:
echo $ANDROID_HOME
I added the Android SDK to my .bash_profile (might be a different file if you are using Linux or Windows) for both ANDROID_HOME and PATH.
# already had these
export PATH="$PATH":"/opt/android-sdk/tools"
export PATH="$PATH":"/opt/flutter-sdk/bin"
# added this
export ANDROID_HOME="/opt/android-sdk"
Replace /opt/android-sdk with wherever yours is.
Then I updated the variables with
source .bash_profile
Testing with flutter doctor showed it was working.
flutter doctor
I restarted Android Studio and the emulator worked.
The last version of Flutter 1.17.5 (release the 2th, July) solved this issue for me.
Just flutter upgrade
run Flutter doctor to make sure you install everything.
run Flutter devices to see whether it is detected by flutter or not.
if you can find the your emulator there run flutter run -d <YOUR_EMULATOR_ID>
if you unable to find your emulator there may be you have to accept the android licenses . run flutter doctor --android-licenses to accept.
run flutter emulators to see list of emulators you have.
run flutter emulators --launch <emulator id> to launch
run Flutter devices to check whether emulator is detected by flutter or not.
run flutter run -d <YOUR_DEVICE_ID>
What worked for me is, updating Android Emulator.
Visit SDK Manager
Check whether any updates available for Android Emulator
If available, install the newest version
Hope this would be helpful!!!
I had this issue on Android Studio.
I had an emulator but it was not recognized even though the emulator was open.
I got around this by launching developer mode inside of the actual emulator by following the steps in this link: https://tweaklibrary.com/how-to-enable-developer-mode-on-android/#:~:text=How%20to%20Enable%20Developer%20Options%20On%20Android.%201,one%20of%20the%20most%20powerful%20...%20More%20items
After setting the emulator to developer mode, the emulator phone appeared as an option and when I ran the flutter hello world it appeared on the emulator.

Resources