Android开发中遇到的两个问题及解决方法

一、创建虚拟机后,运行时,出现如下错误
KVM isrequired to run this AVD.
/dev/kvm is not found.
Enable VT-x in your BIOS security settings, ensure that your Linus distro has working KVM module.

解决方法:
关机,开启电脑,在开机过程中,按Enter键,再按F1进入BIOS界面(不同的电脑进入BIOS界面的快捷键不同);
将左右光标移动到"Security"页;
用上下光标移动到"Virtualization"项,按下Enter;
再用上下光标移动到"Inter® Virtualization Technology"项;
选择“Enable”,按F10保存,退出,重启系统。

二、.模拟器启动后,弹出错误提示对话框,内容如下:
Installation failed with message Failed to finalize session : INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.

WARNING: Uninstalling will remove the application data!

Do you want to uninstall the existing application?

解决方法:
这是由于使用了native libraries,而native libraries不支持当前的cpu的体系结构,可以使用修改配置文件的方法加以解决。
打开工程“app”目录中的“build.gradle”文件,找到如下位置:
android {
compileSdkVersion 23
buildToolsVersion ‘25.0.0’
在下面添加如下语句:
splits {
abi {
enable true
reset()
include ‘x86’, ‘armeabi-v7a’,‘x86_64’
universalApk true
}
}
保存,重启模拟器。

你可能感兴趣的:(Android开发中遇到的两个问题及解决方法)