Docker中的Android模拟器

时间:2015-03-17 00:29:47

标签: android jenkins docker

我试图在docker容器中启动Android模拟器,但是我收到错误:

root@686d602e6ffa:~/android-sdk-linux/tools# ./emulator            
ERROR: 32-bit Linux Android emulator binaries are DEPRECATED, to use them
       you will have to do at least one of the following:

       - Use the '-force-32bit' option when invoking 'emulator'.
       - Set ANDROID_EMULATOR_FORCE_32BIT to 'true' in your environment.

       Either one will allow you to use the 32-bit binaries, but please be
       aware that these will disappear in a future Android SDK release.
       Consider moving to a 64-bit Linux system before that happens.

但容器内的操作系统是(uname -a

Ubuntu SMP Tue Mar 10 20:06:50 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

手动启动emulatox64-x86可以正常工作:

android-sdk-linux/tools# ./emulator64-x86 
emulator: ERROR: You did not provide the name of an Android Virtual Device
with the '-avd <name>' option. Read -help-avd for more information.

If you *really* want to *NOT* run an AVD, consider using '-data <file>'
to specify a data partition image file (I hope you know what you're doing).

我可能会建立一个符号链接 - 但我认为这不是一个好的解决方案,因为可能有不同的架构来模仿

此模拟器也应该由Jenkins启动,它位于上面提到的容器中

更新: 正如@ user2915097建议: root@686d602e6ffa:/# file /bin/bash /bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24

3 个答案:

答案 0 :(得分:3)

仅仅是一个FYI:我在基于FROM ubuntu:16.04 的docker上遇到了这个问题,最后通过安装“file”来apt-get install file

解决了这个问题。

显然模拟器使用file查看$ SHELL,如果它不包含“x86_64”,则认为它是32位。

答案 1 :(得分:0)

摘自https://github.com/docker/docker/issues/611

uname总是告诉你64位。看看例如&#34; file / bin / sh&#34;看到文件系统的真正拱门。

答案 2 :(得分:0)

你可以建立一个符号链接 - 但我认为这不是一个好的解决方案,因为可能有不同的架构来模仿