当我触摸屏幕并且不离开手指时,Cordova 应用程序运行最流畅

问题描述 投票:0回答:1

最近我为在 Cocos Creator 引擎中创建的 html5 游戏创建了一个 Cordova 应用程序。 一段时间后,我注意到应用程序在 Android 上运行不如在浏览器中运行那么流畅。我用谷歌搜索了很多问题,但他们都说问题是 Cordova 使用一些默认的 Web 视图,性能很差。我尝试了很多解决方案,但没有人帮助我。

今天我注意到,当我运行我的应用程序时,触摸屏幕并且手指不离开,应用程序开始运行得非常流畅(就像在浏览器中一样)。我想知道这种行为的原因是什么? 也许只有当我触摸屏幕时才开始运行一些加速?

此外,欢迎任何关于如何修复 Cordova android 构建中的滞后问题的建议。

我尝试过的解决方案:

插件: 离子网络视图, Crosswark-webview

设置

android:硬件加速

真/假

在清单中

其他一些网上的小解决方案,我暂时不记得了。这些都没有帮助我。只有当我触摸屏幕时,我才能看到性能提升。

此问题仅出现在我的新手机(2020 年购买)上, 在旧版(2017 年)应用程序中,无需触摸即可流畅运行。

谢谢!

更新 Cordova 版本是 10.0.0([电子邮件受保护]) 平台android版本是9.1.0

配置.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget android-packageName="com.android.m" android-versionCode="6" id="com.android.m" version="1.5" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>My game</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="[email protected]" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
        <preference name="AndroidXEnabled" value="true" />
        <preference name="android-targetSdkVersion" value="30" />
        <preference name="orientation" value="portrait" />
        <preference name="Fullscreen" value="true" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
</widget>
android cordova cocos2d-x
1个回答
0
投票

为什么要在 Cocos Creator 引擎中创建 HTML5 游戏,然后将其放入 Cordova 应用程序的 webview 中? Cocos Creator 不能直接构建到 Android 或 iOS 应用程序中吗?这难道不会提供更好的性能吗?

© www.soinside.com 2019 - 2024. All rights reserved.