No Devices in VS Code - Flutter - android

I'm new to flutter app devleopment. I've installed Flutter SDK and I'm using VS Code. I want to test my demo app in my android device, I've enabled Developer mode and USB debugging option in my android device. In the status bar, VS Code shows, No Device though I connected via USB cable. How to resolve this problem? Do we need Android SDK for this?
Screenshot

connect your phone then you need to run adb devices on command line while your phone is unlocked it will show allow debug alert on phone accept and it will show
you can download command line tools and use sdk manager if you don't have android sdk

Run VS Code as administrator.
Check the result from terminal output: flutter doctor

Related

no device in android studio with flutter

I installed the Flutter correctly and added it in the environment variables and also added Dart
I added an emulator and ran it before creating a project as a kind of experiment
When I create a project, it does not give me the device
As shown in the pictureenter image description here
To prepare to run and test your Flutter app on an Android device, you’ll need an Android device running Android 4.1 (API level 16) or higher.
Enable Developer options and USB debugging on your device. Detailed instructions are available in the Android documentation.
Using a USB cable, plug your phone into your computer. If prompted on your device, authorize your computer to access your device.
In the terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device.
Start your app by running flutter run.
By default, Flutter uses the version of the Android SDK where your ADB tool is based. If you want Flutter to use a different installation of the Android SDK, you must set the ANDROID_HOME environment variable to that installation directory.

Is there a alternative to installing android emulator during flutter dev for low end pc?

I am getting started with flutter. After a day of installing all the required stuff and running an android emulator for the first time, I figured that my pc is not powerful enough for running android without significantly slowing down the computer.
(Nope, I cant upgrade my pc.)
I was wondering if there is any way I can do flutter on my pc. Any way to get something like ui output on dartpad.
I am using VSCode.
If you have an android phone, just turn on developer mode and USB debugging on it and connect it to your computer and click run. Then the apk file will be installed on your phone and it will instantly change states whenever you click run. If you don't have an android phone you can easily get a decent one for just under $50.
If you have physical android device, you can connect it to your computer. and type flutter run in your terminal.
or
use flutter web(beta) type flutter run -d chrome in your terminal.

How to enable device option to connect to external device on android studio?

I'm trying to connect my android device to android studio to run flutter but keep having this issue:
The result should be like this:
But instead, I can't open the device option on my android studio:
When I run flutter doctor there is no error and the device I plug in show up.
The machine I'm using is Asus TUF A15 which runs AMD Ryzen 5 4600H processor.
Can anyone please show me the way to enable this option?
Thank you in advance!
Enable developer options and USB debugging on your android device. More information can be found on the Android documentation here.
Plug your phone into your computer with a USB cable. Allow your computer to access your device if prompted.
In your terminal, run flutter devices to verify that Flutter recognizes your devices
Run flutter run to start your Flutter app or use the function available in Android Studio.
You should also try another USB cable, another Android device, or even another USB port on your computer. (Something simple, but can easily get overlooked)

No target specified and no devices found, deploying to emulator on running Cordova run android on Mac to an Android device

I am using Cordova and want to debug the app on my Android device.
When I am plugging the device I have to accept MTP permission - I did so.
I also enabled developer USB mode in the device settings.
When I run the next command:
cordova run android
The app is getting installed in the device in 50% success rate.
I don't know why, but sometimes its just working and the app pops up and sometimes its just not working.
I have tried to reconnect the USB, after 10 times of doing so, it works and then again start to get corrupt.
It's a new brand original samsung cable that I am using.
I am using Android file transfer in my Mac in order to make this working (without this, it does not working at all).
I have two questions, one related to Cordova and one related to the Android device USB:
How to make the device reachable for the Mac so I can transfer data without interruptions?
Is there any option to tell Cordova to build WIRELESS? I know it's possible using Ionic with --livereload flag. However I don't use Ionic with this project.
I have tried to do cordova run android -- --live-reload (in the cordova project) but this doesn't really doing something - it does not response when there is change in the build or something.
You already enable development mode. You are facing 50% success rate. I didnt get your main issue.
I have suggestion and step which you can follow to make work as I always do.
Step 1) Enable development mode
Step 2) Authenticated the connect device.
- When you connect first you will get authentication confirmation in device.
Step 3) Check connected or not(most recommend command when you connect, just cross chekc and sometime this command properly your device by starting adb server which is required to run application in android)
adb devices
(Open terminal and typpe this command)
Note : Make sure connected device show in terminal and authenticated.

Expo with Android Studio Emulator error: "Error running adb: This computer is not authorized to debug the device"

I am trying to connect an Android Studio Emulator to my expo application, but I get this error message:
Couldn't start project on Android: Error running adb: This computer is
not authorized to debug the device. Please follow the instructions
here to enable USB debugging:
https://developer.android.com/studio/run/device.html#developer-device-options.
If you are using Genymotion go to Settings -> ADB, select "Use custom
Android SDK tools", and point it at your Android SDK directory.
Does anyone know what to do with this?
Thanks!
What has worked for me just now:
Go to tools.
Select avd in Android studio.
Select your emulator.
Wipe data.
Click "Start again".
tldr:
Look at the emulator "screen" and accept the prompt asking if you want to allow debugging.
I got that message you described in the question when I did the following:
In Android Studio Virtual Device Manager (VDM), start the emulated device
run npm start (which runs expo start)
expo Metro Bundler runs (command line and browser)
in expo: select Android emulator
in expo: see the same error that you posted
The provided link didn't seem to pertain to the emulator.
I didn't realize at first, but the solution was waiting on the screen of the emulated device. It was quietly showing a standard Android permission prompt, asking for permission to allow debugging the device. This prompt is described in the "note" in https://developer.android.com/studio/command-line/adb#Enabling,
Note: When you connect a device running Android 4.2.2 or higher, the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer. This security mechanism protects user devices because it ensures that USB debugging and other adb commands cannot be executed unless you're able to unlock the device and acknowledge the dialog.
This of course I would expect for a phone, but didn't think of it for an emulator.
Once I granted that permission in the emulated phone, then expo proceeded to run on the emulator.
I discovered that "USB Debugging" had been turned off in the Developer Options of the emulator. Turning it on fixed the problem. No idea how it came to be turned off.
I had this problem today, I just disabled USB debugging and enabled it again. Worked.
Go to android studio
Open AVD manager
Wipe data on your emulator (Clicking dropdown icon in actions column )
Launch emulator
enjoy :)
First close your opened android emulator.
Open android studio and go to AVD manager.
Select virtual device which you have faced trouble, under actions select wipe
data option.
Give ok for the opened window.
These steps worked for me.
I was using the emulator from Android Studio for my expo projects. It used to work properly.
Then, one day the emulator stopped interacting with expo, always saying:
This computer is not authorized for developing on .
https://expo.fyi/authorize-android-device
The advices given on that link did not help. Revoking the USB permissions did not help either. Even newly created Devices in AVD Manager did not let me connect.
However, finally this answer solved the problem for me
Choosing a device from AVD Manager without Google Play Store on it let me connect expo to the emulator, again.
Note: I could not get to the root cause of the problem, so I am still not sure why it stopped working all of a sudden. I upgraded to Expo SDK 39 at the same time that I switched from managed workflow to bare workflow. So, one of those circumstances may have caused the problem.
I know the exact answer of this question
The Problem is your AVD manager is not set to the path
Than you have add to path first is ANDROID_SDK_ROOT and PLATFORM-TOOLS
HERE I GIVE ALL THE LOCATION PLATFORM TOOLS - C:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk\platform-tools
ANDROID_DK_ROOT - C:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk
ADD in path (SEARCH ON START EVIRONMENT VARIABLES) and than restart your pc
Try running a lower version of the android emulator from android studio. I was getting the same error while trying to run the latest expo-react-native app on android emulator version 9.0 Pie. I got it working by running a lower version of the android emulator version 8.1 Oreo. You also have to tab allow/ok on the phone screen when asked for enable USB Debugging
during the app booting on the emulator.
I had the same issue and it almost took one day to figure that out.
First try enabling the USB debugging mode, still if it shows the same error try the next step. Try to check ADB devices in cmd, if it doesn't work go and change the environmental variables of the android SDK manager.
And refer this link
https://medium.com/#vsburnett/running-a-react-native-app-on-an-android-virtual-device-with-expo-in-windows-10-9e0976db5f50
For Windows:
Select 'Wipe Data' option in the AVD manager and restart again.
Or
Add SDK tools path eg: E:\Android\SDK and SDK platform-tools path eg: E:\Android\SDK\platform-tools in the windows system environmental variables. (In my case I have installed SDK inside the E directory)
Open the Android Virtual Device Manager(AVD Manager).
And in your current virtual device on the right side, there will be a dropdown icon, and click that icon.
In the dropdown list there will be a Wipe Data and click it.
And Run your Emulator
I was facing the same issue. I am using windows machine. Steps I did to resolve:
I have added the environment variable.
To Add System Variable, search environment variable in Windows (or search google how to open environment variables, if you are on some other system or cmd). In the system variable add the Variable: ANDROID_SDK_ROOT to your android studio path, like in my case it is: C:\Users\kushalseth\AppData\Local\Android\Sdk
At the same place, i.e. System Variable, Click on Path and add this, it already doesn't exists. Please check this path in your system: C:\Users\kushalseth\AppData\Local\Android\Sdk\platform-tools
To Validate, run the command: adb in command prompt.
(Also check, if you are logged-in to expo from cmd. This is an extra precautionary step.)
today I experience the same issue but I have fixed it very easily. Try the solution it might work for you too.
Many developers have wsl or windows subsystem for Linux and it is using a VM and I found it blocks the android sim and causes the error "Error running adb". The solution I found was to open my PowerShell and type "wsl --shutdown". After rerunning the script for android emulation from expo it worked like a charm. Hope I helped.
There are two ways of doing this.
Wipe SDK data
Kill a running emulator
First step:
Open android studio > virtual device > click on more_vert > select wipe data
Second step:
Open your command prompt and use this command
adb -e emu kill
or
If Expo CLI is running, stop it with ctrl+c -- this will stop ADB.
Disconnect your Android device from the computer.
Revoke USB Debugging on the device:
Open the Settings app on your device.
Navigate: Developer Options -> select Revoke USB debugging authorizations.
Reconnect the device:
The device will prompt you to agree to connect the computer. You must confirm it.
The computer is now authorized for debugging!
This computer is not authorized for developing on. https://expo.fyi/authorize-android-device
I resolved this issue by choosing a device without the google play store
(play button).
Enable Virtualization on your machine
Enter your BIOS settings on boot of your machin and enable Virtualization Technology. The location may differ depending on your processor.

Categories

Resources