How to fix visual studio code not finding device for flutter development even thought device is connected?

Viewed 254

I'm learning to develop mobile applications using flutter. Flutter installation and all other settings went smoothly. I'm using Visual Studio Code as the editor as per personal preference.

But when I'm trying to find my device in Visual Studio Code, it keeps showing 'No Device' at bottom right corner.

When I ran flutter doctor it showed everything fine, it showed my device connected and available.

I also checked using flutter devices, that also shows the device name and all that.

After that, I ran adb devices command inside platform-tools directory, that listed my device as well.

I tried disconnecting/reconnecting my device couple of times and restarting VS Code but of no use.

I have also searched for errors using Toggle Developer Tools in VS Code, found no error there too.

My device has its USB debugger enabled obviously otherwise flutter devices would not list it.

I'm running a Ubuntu 16.04, 64 bit operating system. My device is a Xperia XA2 Ultra phone.

VS Code keeps showing 'No Device', clicking it shows no device.

I have searched a lot, but there's not much question about exactly this problem.

Some clue would mean great help. Thanks a lot for your time.

1 Answers

In my case, it was a problem with the right writing privileges on the project folder and flutter itself, as I must have worked as a superuser somewhere along the way... Once I gave the current user writing permission to flutter and the project folder, everything worked fine and my connected smartphone was found (don't forget to restart Visual Studio after adjusting writing permission via the terminal). This is the command to adjust writing permission:

sudo chown -R $USER /user/flutterdev (-> flutter)
sudo chown -R $USER /path/to/your/flutterprojectfolder (-> flutter project)
Related