在Ubuntu 16.04上运行Android模拟器的最佳方法是什么?

时间:2017-07-28 21:25:13

标签: android android-studio android-emulator ubuntu-16.04 genymotion

在Ubuntu上运行Android Emulator似乎比Windows版本更复杂。我没有看到在SDK管理器中下载英特尔硬件辅助虚拟化软件的相同选项,而是我被指示使用KVM根据How to Start Intel Hardware-assisted Virtualization (hypervisor) on Linux to Speed-up Intel Android x86 Emulator链接运行它,这需要Qt,但即使我安装了我收到了以下错误:

./emulator64-arm: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.7' not found (required by ./emulator64-arm)
./emulator64-arm: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by ./emulator64-arm)
./emulator64-arm: /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5: version `Qt_5' not found (required by ./emulator64-arm)
./emulator64-arm: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by ./emulator64-arm)
./emulator64-arm: /usr/lib/x86_64-linux-gnu/libQt5Svg.so.5: version `Qt_5' not found (required by ./emulator64-arm)

我尝试安装qt 5.7版。当我发出qmake -version时,我看到QMake version 3.0 Using Qt version 5.5.1 in /usr/lib/x86_64-linux-gnu ,因此我尝试使用过程here在同一目录中安装新版本的qt,但安装程序只是挂起。但我可以在我的主文件夹中安装qt;然而,这对我没有用,因为它不会改变系统配置,而qmake仍然显示我拥有的旧版qt。以下是我机器上所有不同版本的qt:

$ ls -al /usr/lib/x86_64-linux-gnu/qt*
/usr/lib/x86_64-linux-gnu/qt4:
total 116
drwxr-xr-x   4 root root   4096 Jul 19  2016 .
drwxr-xr-x 128 root root 102400 Jul 28 16:01 ..
drwxr-xr-x   2 root root   4096 Jul 19  2016 bin
drwxr-xr-x  16 root root   4096 Dec  1  2016 plugins

/usr/lib/x86_64-linux-gnu/qt5:
total 128
drwxr-xr-x   7 root root   4096 Jun 16 22:31 .
drwxr-xr-x 128 root root 102400 Jul 28 16:01 ..
drwxr-xr-x   2 root root   4096 May 16 15:30 bin
drwxr-xr-x   2 root root   4096 Jul 19  2016 libexec
drwxr-xr-x  97 root root   4096 May 16 15:30 mkspecs
drwxr-xr-x  17 root root   4096 Jun 16 22:31 plugins
drwxr-xr-x  11 root root   4096 Jul 19  2016 qml

/usr/lib/x86_64-linux-gnu/qt7:
total 108
drwxr-xr-x   2 root root   4096 Jul 26 17:25 .
drwxr-xr-x 128 root root 102400 Jul 28 16:01 ..

/usr/lib/x86_64-linux-gnu/qtchooser:
total 108
drwxr-xr-x   2 root root   4096 May 16 15:30 .
drwxr-xr-x 128 root root 102400 Jul 28 16:01 ..
lrwxrwxrwx   1 root root     50 Nov  7  2016 4.conf -> ../../../share/qtchooser/qt4-x86_64-linux-gnu.conf
lrwxrwxrwx   1 root root     50 May 12 14:47 5.conf -> ../../../share/qtchooser/qt5-x86_64-linux-gnu.conf
lrwxrwxrwx   1 root root     50 May 12 14:47 default.conf -> ../../../share/qtchooser/qt5-x86_64-linux-gnu.conf
lrwxrwxrwx   1 root root     50 Nov  7  2016 qt4.conf -> ../../../share/qtchooser/qt4-x86_64-linux-gnu.conf
lrwxrwxrwx   1 root root     50 May 12 14:47 qt5.conf -> ../../../share/qtchooser/qt5-x86_64-linux-gnu.conf

/usr/lib/x86_64-linux-gnu/qt-default:
total 112
drwxr-xr-x   3 root root   4096 Jul 19  2016 .
drwxr-xr-x 128 root root 102400 Jul 28 16:01 ..
drwxr-xr-x   2 root root   4096 Jul 19  2016 qtchooser

我想知道运行模拟器可能有更好的方法,因为我在Ubuntu上看到关于Genymotion和Android的其他许多虚拟化软件的评论,我已经下载但是我看不到我如何运行avd I使用genymotion在SDK文件夹中创建。相反,有一些图像,您可以选择。在Ubuntu上运行Android模拟器以测试应用程序的最佳方法是什么?

我看到了this链接,它提示了以下命令:`LD_PRELOAD ='/ usr / $ LIB / libstdc ++。so.6'DISPLAY =:0 ./emulator -avd Nexus -qemu -m 2047 - 启用的KVM

这似乎导致模拟器在我获得核心转储之前出现了一小段时间,并出现以下错误:

emulator: WARNING: Ignoring invalid http proxy: Empty proxy configuration string

*** Error in `/home/sansari/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-i386': double free or corruption (fasttop): 0x00007f82f0029670 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f83e7ed77e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f83e7ee037a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f83e7ee453c]
/usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so(+0x4a4db5)[0x7f83c5e61db5]
/usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so(+0x4a50a3)[0x7f83c5e620a3]
/usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so(+0x1de93d)[0x7f83c5b9b93d]
/usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so(+0x1de980)[0x7f83c5b9b980]
/home/sansari/Android/Sdk/emulator/lib64/lib64OpenglRender.so(+0x45e9a)[0x7f83d090de9a]
/home/sansari/Android/Sdk/emulator/lib64/lib64OpenglRender.so(+0x32f42)[0x7f83d08faf42]
/home/sansari/Android/Sdk/emulator/lib64/lib64OpenglRender.so(+0x646e)[0x7f83d08ce46e]
/home/sansari/Android/Sdk/emulator/lib64/lib64OpenglRender.so(+0x67884)[0x7f83d092f884]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7f83ea46d6ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f83e7f673dd]
======= Memory map: ========

`

1 个答案:

答案 0 :(得分:1)

Download Android Studio

导入您的Android项目。

从菜单中点击RUN>运行APP

Android Studio会弹出提示:单击“创建新虚拟设备”。 它将引导您完成下载您喜欢的Android系统映像的步骤,并在几秒钟内启动模拟器。