Brief
I am new to Flutter. I installed Android Studio and Flutter source code as mentioned in Flutter's Installation guide for windows. I had a problem with the lack of storage space on C:Drive
as mentioned in my previous question, so I installed Android Studio entirely on my E:Drive
using Jet Brains ToolBox instead of breaking my head with symbolic links for everything, following the answer of the previous question, but I ran into another problem after having everything on my E:Drive
, whenever I try to run an Android Virtual Device or run flutter doctor -v
, I get the following error:
Error Message
Connected device (the doctor check crashed)
X Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
X Exception: Unable to run "adb", check your Android SDK installation and ANDROID_SDK_ROOT environment variable: E:\Android\Sdk\platform-tools\adb.exe
• #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 AndroidDevices.pollingGetDevices (package:flutter_tools/src/android/android_device_discovery.dart:75:7)
<asynchronous suspension>
#2 PollingDeviceDiscovery._populateDevices (package:flutter_tools/src/device.dart:413:54)
<asynchronous suspension>
#3 Future.wait.<anonymous closure> (dart:async/future.dart)
<asynchronous suspension>
#4 DeviceManager.getAllConnectedDevices (package:flutter_tools/src/device.dart:170:40)
<asynchronous suspension>
#5 DeviceValidator.validate (package:flutter_tools/src/doctor.dart:515:34)
<asynchronous suspension>
#6 asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:24)
<asynchronous suspension>
I also tried to use VS Code with the flutter-dart extension but I keep getting the message Flutter daemon has terminated
.
When I tried to run the adb server manually, I keep getting the following error
* daemon not running; starting now at tcp:5037
could not read ok from ADB Server
* failed to start daemon
error: cannot connect to daemon
So I even tried to kill the server and got the following error
cannot connect to daemon at tcp:5037: cannot connect to 127.0.0.1:5037: No connection could be made because the target machine actively refused it. (10061)
Little More Info
I have the following folders at these locations:
Folder | Location |
---|---|
Android Studio |
E:\Users{user}\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio |
Flutter |
D:{user}\Documents_HDD\Programming\Flutter\flutter |
Android Sdk |
E:\Android\Sdk |
.android |
E:\Android.android |
Also the .android
folder was stored in AppData\Local
but I observed that flutter tried to create another .android
folder inside the Sdk folder and that caused an error stating avd
path is broken, so I moved the .android folder into Sdk folder.
I have been facing this issue for a few months now. I have searched the net for some solutions but none of them has worked. I tried the following
- Adding the environment variables
ANDROID_SDK_ROOT
,ANDROID_AVD_HOME
,ANDROID_PREFS_ROOT
and path variables toplatform-tools
andtools
folders present in the Sdk folder - Allowing
adb.exe
through the firewall and antivirus program. - I even checked if there is any other program running at
tcp:5037
port but there was no program using that port.
None of these solutions worked. Can someone please help me with this problem? I want adb to work properly for flutter development.
If any further information is required, please let me know in a comment rather than an answer.