温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

在android studio中启动emulator闪退怎么解决

发布时间:2022-04-16 16:30:25 来源:亿速云 阅读:685 作者:iii 栏目:开发技术

这篇文章主要介绍“在android studio中启动emulator闪退怎么解决”,在日常操作中,相信很多人在在android studio中启动emulator闪退怎么解决问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”在android studio中启动emulator闪退怎么解决”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

平台

Ubuntu14.04 64

现象

在AndrodStudio中点击模拟器的启动按钮后,模拟器界面弹出后,又立刻闪退。

解决

一、查看模拟器的信息

在android studio中启动emulator闪退怎么解决

从上面可以看到模拟器的存放路径以及名称:

路径:/home/pengdonglin/.android/avd/4_WVGA_Nexus_S_API_24.avd

名称:4_WVGA_Nexus_S_API_24

架构:x86_64

二、命令行运行模拟器

在androidsdk的路径下面运行下面的命令:

./emulator/qemu/linux-x86_64/qemu-system-x86_64 -avd 4_WVGA_Nexus_S_API_24
此时出现了错误:

emulator: WARNING: encryption is off
WARNING: The Mesa software renderer is deprecated. Use Swiftshader (-gpu swiftshader) for software rendering.
failed to create drawable
getGLES2ExtensionString: Could not create GLES 2.x Pbuffer!
Failed to obtain GLES 2.x extensions string!
Could not initialize emulated framebuffer
warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]
warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6]
emulator: emulator window was out of view and was recentered
emulator: ERROR: Could not initialize OpenglES emulation, use '-gpu off' to disable it.

从提示中有两种解决办法:

1、设置 -gpu swiftshader

2、设置 -gpu off

在运行模拟器的时候,加入上面任意一个,都可以解决问题,但是最终我们并不是从命令行运行模拟器,所以我们得把这上面的配置写到模拟器的启动配置文件中。

从模拟器的配置信息看:

在android studio中启动emulator闪退怎么解决

这里已经设置了软件GLES 2.0,所以这里就需要在配置文件中修改模拟器的配置了,配置文件的路径:

~/.android/avd/4_WVGA_Nexus_S_API_24.avd/config.ini

下面是这个文件中关于GPU的配置:

hw.gps=yes
hw.gpu.enabled=yes
hw.gpu.mode=mesa

解决方法1:

hw.gpu.enabled=no
hw.gpu.mode=mesa

解决方法2:

hw.gpu.enabled=yes
hw.gpu.mode=swiftshader

使用上面的任意一个,模拟器都可以运行:

在android studio中启动emulator闪退怎么解决

到此,关于“在android studio中启动emulator闪退怎么解决”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI