带有“模拟器:错误:找不到SDK安装目录”的Android模拟器错误; [英] Android emulator errors with "emulator: ERROR: can't find SDK installation directory"

查看:663
本文介绍了带有“模拟器:错误:找不到SDK安装目录”的Android模拟器错误;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows(不带Android Studio)上从命令行安装和运行Android虚拟设备。我已经在C:\Android中设置了Android SDK,并使用以下命令成功创建了AVD:

  avdmanager create avd -n test -k系统图像; android-26; google_apis_playstore; x86 --abi google_apis_playstore / x86 

我将环境变量ANDROID_SDK_ROOT设置为C:\Android。



当我尝试从命令行启动仿真器时:

 模拟器@test 

我收到错误消息:

 模拟器:错误:找不到SDK安装目录
模拟器:找不到虚拟设备名为测试使用以下命令指定sysdir和datadir:

 模拟器@test -sysdir C:\Android\system-images\android -26\google_apis_playstore\x86 -datadir C:\Android\avd 

但我遇到相同的错误。



当我跑步时命令 avdmanager.bat list avd ,我得到:

 名称:test 
路径:C:\Android\avd\test.avd
目标:Google Play(Google Inc.)
基于:Android API 26标签/ ABI:google_apis_playstore / x86

为什么我不能运行AVD?

解决方案

我发现了问题。因为我试图通过命令行进行最小的Android SDK安装,所以我还没有Platform-tools文件夹。找不到平台工具文件夹导致模拟器显示无用的错误找不到SDK安装目录,这实际上意味着找不到平台工具目录。



一旦我用 sdkmanager --no_https platform-tools 安装了platform-tools文件夹,模拟器就可以工作了。我需要-no_https ,因为我处在残缺的公司环境中。



为了以后的参考,我安装了模拟器依赖项(从此处)解压缩sdk-tools-windows-3859397.zip之后) :

  sdkmanager --no_https系统映像; android-26; google_apis_playstore; x86平台; android-26平台工具仿真器 


I am trying to install and run an Android Virtual Device from the command line on Windows (without Android Studio). I have set up an Android SDK in C:\Android, and successfully created an AVD with the command:

avdmanager create avd -n test -k "system-images;android-26;google_apis_playstore;x86" --abi google_apis_playstore/x86

I have environment variable ANDROID_SDK_ROOT set to C:\Android.

When I try to start the emulator from the command line with:

emulator @test

I get errors:

emulator: ERROR: can't find SDK installation directory
emulator: could not find virtual device named 'test'

I have also tried setting environment variables ANDROID_AVD_HOME and ANDROID_EMULATOR_HOME, and also tried running the AVD specifying sysdir and datadir with the command:

emulator @test -sysdir C:\Android\system-images\android-26\google_apis_playstore\x86 -datadir C:\Android\avd

but I get the same errors.

When I run command avdmanager.bat list avd, I get:

    Name: test
    Path: C:\Android\avd\test.avd
  Target: Google Play (Google Inc.)
          Based on: Android API 26 Tag/ABI: google_apis_playstore/x86

Why on earth can't I run the AVD?

解决方案

I found the problem. Because I was trying to do a minimal Android SDK install via the command line, I did not yet have a platform-tools folder. Not being able to find the platform-tools folder was causing the emulator to display the unhelpful error "can't find SDK installation directory", which really meant "can't find the platform-tools directory".

Once I installed the platform-tools folder with sdkmanager --no_https "platform-tools", the emulator worked. I need --no_https because I'm in a crippled corporate environment.

For future reference, I installed the emulator dependencies (after unzipping sdk-tools-windows-3859397.zip from here) with:

sdkmanager --no_https "system-images;android-26;google_apis_playstore;x86" "platforms;android-26" "platform-tools" "emulator"

这篇关于带有“模拟器:错误:找不到SDK安装目录”的Android模拟器错误;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆