这是我的路径
export ANDROID_SDK_ROOT=/mnt/sda1/DevTools/sdk/
export ANDROID_HOME=$ANDROID_SDK_ROOT
export PATH=${PATH}:/mnt/sda1/DevTools/sdk/platform-tools
我尝试了很多情况,但仍然是这个错误!
这是我的路径
export ANDROID_SDK_ROOT=/mnt/sda1/DevTools/sdk/
export ANDROID_HOME=$ANDROID_SDK_ROOT
export PATH=${PATH}:/mnt/sda1/DevTools/sdk/platform-tools
我尝试了很多情况,但仍然是这个错误!
This worked for me. If you have sdkmanager
, avdmanager
and emulator
, and you have them in your PATH environmental variable, then
sdkmanager "system-images;android-30;google_apis_playstore;x86_64"
(you can find available packages with sdkmanager --list --verbose
)
avdmanager create avd --name MyAndroidDevice --package "system-images;android-30;google_apis_playstore;x86_64"
emulator -avd MyAndroidDevice
I know this is an old question but setting my $PATH variable in ~/.bashrc (I'm on Ubuntu 20.04) did not work for me.
I needed to setup Android Emulator for VScode, because I wanted to run my flutter app, which seems to be the same issue as OP had.
Instead of setting the $PATH directly you can actually use Flutter in the terminal to do it.
If you run "flutter config" in the terminal you get something like:
Configure Flutter settings.
To remove a setting, configure it to an empty string.
The Flutter tool anonymously reports feature usage statistics and basic crash reports to help improve Flutter tools over time. See Google's privacy policy: https://www.google.com/intl/en/policies/privacy/
....
Run "flutter help" to see global options.
Settings: android-sdk: <my_path_to_android_tools>
Analytics reporting is currently enabled.
You can then see the $PATH that is currently set with flutter under:
Settings: android-sdk: <my_path_to_android_tools>
Mine was incorrect so I changed it to the current one with the command:
flutter config --android-sdk <my_path_to_android_tools>
Afterwards I restarted VScode and when it was finished loading I could now press the "device" button in the right hand corner and then select emulator that I had already created. I used one of the above answers to install the emulator itself.
It took a while to launch the emulator the first time due to installing some dependencies but it did work!
I tried this and works:
flutter config --enable-android
. You will get Setting "enable-android" value to "true".
Open Android Studio -> Configure -> AVD Manager -> Create Your Virtual Device
Ctrl+P
or cmd+P
, then type >
), or from View -> Command palette... -> Flutter: Select Device -> choose your android device
Try :
if something wrong, try to locate android sdk path.
Mine :