在不安装Android Studio的情况下安装Android模拟器 [英] Install Android emulator without installing Android Studio
问题描述
我只想设置没有Studio-ide的android仿真器,并像移动设备一样使用它并对其进行调整.
I just want to set android emulator without studio-ide and use it like a mobile and tweak it.
我已经从 https://dl下载了命令行工具.google.com/android/repository/commandlinetools-linux-6858069_latest.zip
在文件夹 $ HOME/AndroidSDK
中解压缩.
我只想运行一些模拟器.
I just want to run some emulators.
然后跑到下面
cd ~/AndroidSDK/cmdline-tools/bin
./sdkmanager --sdk_root=$HOME/AndroidSDK/cmdline-tools --list --include_obsolete --verbose
./sdkmanager --sdk_root=$HOME/AndroidSDK/cmdline-tools --verbose "emulator" "platforms;android-25" "system-images;android-25;default;arm64-v8a" "platform-tools"
./sdkmanager --sdk_root=$HOME/AndroidSDK/cmdline-tools --licenses
./avdmanager -v create avd -n Nougat -k "system-images;android-25;default;arm64-v8a"
创建avd时出现以下错误.
I got below error when creating avd.
Error: Package path is not valid. Valid system image paths are:ository...
null
它与如何在没有android studio的情况下创建android仿真器相关?
但是我找不到解决我问题的合适方法.
It is related to How create android emulator without android studio?
But I can't find proper solution to my problem.
哪里出错了?
参考:- https://stackoverflow.com/a/59907256/11620356
推荐答案
我正在回答自己的问题.
I am answering my own question.
我做错的地方是,解压缩到错误的目录并使用错误的--sdk_root.如此处所述,我必须创建一个名为 cmdline-tools
的目录并在其中解压缩.现在,我们将有另一个cmdline-tools目录.我们必须将其重命名为我们正在使用的相应命令行工具版本.在我的情况下是3.0.
Where I made wrong is, decompressing to wrong directory and using wrong --sdk_root.
As said in here, I have to create a dir called cmdline-tools
and decompress in it. Now we will have another cmdline-tools dir. We have to rename it to the respective commandline tool version we are using. In my case it is 3.0.
最后,我的脚本应如下图所示.
Finally my script should be look like below.
mkdir -p ~/AndroidSDK/cmdline-tools
cd ~/AndroidSDK/cmdline-tools
wget https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip -o tools.zip
unzip -q tools.zip
mv cmdline-tools 3.0
cd 3.0/bin
./sdkmanager --list --include_obsolete --verbose
./sdkmanager --verbose "emulator" "system-images;android-25;default;arm64-v8a" "platforms;android-25" "platform-tools"
./sdkmanager --licenses
./avdmanager -v create avd -n Nougat -k "system-images;android-25;default;arm64-v8a"
../../../emulator/emulator -avd Nougat
有关更多信息,请参见 https://github.com/HemanthJabalpuri/AndroidEmulator_without_Studio .
See https://github.com/HemanthJabalpuri/AndroidEmulator_without_Studio for more info.
这篇关于在不安装Android Studio的情况下安装Android模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!