在Android开发中遇到的问题和错误

1、虚拟机提示

Cannot launch AVD in emulator.
Output:
emulator: WARNING: Classic qemu does not support SMP. The hw.cpu.ncore option from your config file is ignored.
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: HAXM is not installed on this machine

解决方案:

点击上图选中的按钮

勾选前面的框框然后安装HAXM

之后在你Android Studio安装的sdk目录下找到

。。。SDK\sdk\extras\intel\Hardware_Accelerated_Execution_Manager

双击蓝框中的exe应用程序,进行安装,重启Android Studio就可以运行了。

 

2、虚拟机黑屏问题

打开虚拟机后一直黑屏不显示,很可能就是不兼容不适配的问题,现在大多都是64位

解决方案:

找到你的虚拟机,点击Change按钮

扫描二维码关注公众号,回复: 11173113 查看本文章

选择x86_64的ABI

如果没有,则选择上面的Show downloadable system images按钮,找到对应的ABI进行下载

重启后解决问题

3、布局文件提示错误信息

Rendering Problems
The following classes could not be found: - android.support.v7.internal.app.WindowDecorActionBar (Fix Build Path, Create Class)
Tip: Try to build the project.
Failed to find the style corresponding to the id 2147418314
(6 similar errors not shown)
onMeasure error (Details) (2 similar errors not shown)

解决方案:

在res/values/styles目录下找到parent,在其中添加Base.。。。问题解决

4、RecyclerView中的显示问题

我们在最后显示时有可能出现这样的结果,每一页只有一个item组件显示,并不是我们想要的那种效果

            

解决方案:

在设置组件的xml文件中,一定要将布局管理器中的android:layout_height="match_parent"改为wrap_content,因为你的布局要是匹配父控件,则不管怎么设置控件都会按整个屏幕显示,所以要将其改为wrap_content,包裹其自身

原创文章 30 获赞 5 访问量 1905

猜你喜欢

转载自blog.csdn.net/qq_41890177/article/details/105377893