两个问题 1、启动安卓模拟器,报错 The emulator process for AVD Pixel_2_API_25 was killed.
2、cordova 启动模拟器失败
报错:
然后点击模拟器管理里面的 “下三角", -》show on disk
将
hw.gpu.enabled=yes
hw.gpu.mode=auto
修改为
hw.gpu.enabled=no
hw.gpu.mode=off
重启模拟器,果然OK啦。
造成这个的原因;
我先安装了android开发环境,模拟器等都正常使用;随后安装了cordova编译环境,造成资源冲突,原来的模拟器报错,cordova下的模拟器也起不来。
进过这么一改,安卓开发环境ok啦,然后先启动这个安卓模拟器,在执行cordova run android 命令,结果cordova 环境也可以了,编译完之后直接在模拟器运行目标程序,如下图:
【付cordova run android 启动过程】
D:\vue\my_vueworkspace\cordova\cordovaApp>cordova run android
CHCP plugin after prepare hook:
config-file preference is not set.
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Users\uuzz\AppData\Local\Android\Sdk (recommended setting)
ANDROID_HOME=C:\Users\uuzz\AppData\Local\Android\Sdk (DEPRECATED)
Using Android SDK: C:\Users\uuzz\AppData\Local\Android\Sdk
Reading build config file: D:\vue\my_vueworkspace\cordova\cordovaApp\build.json
Configure project :app
WARNING: Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’.
It will be removed in version 5.0 of the Android Gradle plugin.
For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 3s
40 actionable tasks: 40 up-to-date
Built the following apk(s):
D:\vue\my_vueworkspace\cordova\cordovaApp\platforms\android\app\build\outputs\apk\debug\app-debug.apk
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Users\uuzz\AppData\Local\Android\Sdk (recommended setting)
ANDROID_HOME=C:\Users\uuzz\AppData\Local\Android\Sdk (DEPRECATED)
Using Android SDK: C:\Users\uuzz\AppData\Local\Android\Sdk
No target specified and no devices found, deploying to emulator
Reading build config file: D:\vue\my_vueworkspace\cordova\cordovaApp\build.json
Using apk: D:\vue\my_vueworkspace\cordova\cordovaApp\platforms\android\app\build\outputs\apk\debug\app-debug.apk
Package name: io.cordova.hellocordova
INSTALL SUCCESS
LAUNCH SUCCESS
修改参考:
https://blog.csdn.net/weixin_42731568/article/details/110383711?utm_medium=distribute.pc_relevant_bbs_down.none-task-blog-baidujs-1.nonecase&depth_1-utm_source=distribute.pc_relevant_bbs_down.none-task-blog-baidujs-1.nonecase