android - 我的 cordova webview 应用程序真的比同一部手机上的 android 浏览器慢

标签 android performance cordova ionic-framework hybrid-mobile-app

我使用 ionicframework 和 cordova 构建了一个 android 应用程序。

但是当我尝试在我的 Samsung Galaxy S4 上运行时,该应用程序确实比我手机的网络浏览器中的相同代码慢。

我怎样才能期望拥有相同的性能?

我试过了:

android:hardwareAccelerated="true"

this.appView.getSettings().setRenderPriority(RenderPriority.HIGH);
this.appView.getSettings().setPluginState(android.webkit.WebSettings.PluginState.ON_DEMAND);

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />

最新的 3.6 cordova 版本

我怎样才能拥有与我在手机浏览器上看到的相同的性能(例如,具有元应用程序功能)?

最佳答案

很难判断,因为您没有提供代码或示例。
如果您使用的不是最新的 Android 4.4 KitKat,您可能使用的是非常旧的 WebView .

Older versions of Android devices (4.0-4.3) use Android’s default browser, which has significantly less performance and standards compliance than modern Chrome. Using Crosswalk gives you a specific and more performant version of Chrome to use on all Android devices, in order to reduce fluctuations and fragmentation among devices.

article问题更深入,值得一读。

如果您想获得与网络浏览器相同的性能,您可以使用 Crosswalk 替换您的网络运行时。 .

人行横道可以是easilyCordova 集成。

使用 ionic 框架,您可以 simply :

ionic browser add crosswalk

如果您想指定不同版本的 Crosswalk,请运行 ionic browser list 以查看可用的浏览器和版本。然后运行:

ionic browser add crosswalk@10.39.235.15

Nick Raboy写了一个interesting article它将指导您完成将 CrosswalkCordova + Ionic Framework 集成所需采取的所有步骤。

非常有帮助的视频以简单的方式解释了一切。

人行横道也可用于Shared Mode :

"Shared mode" allows multiple Crosswalk applications to share one Crosswalk runtime. If the runtime is not already installed in the device, it will be downloaded either from the Google Play Store, or from a download location specified by the developer. When using this feature, the Crosswalk library is not included in the application's package, making it significantly smaller.

生成的 APK 文件大小明显更小。

它尚未集成到 ionic 框架中,并且没有包含此的路线图 feature .

关于android - 我的 cordova webview 应用程序真的比同一部手机上的 android 浏览器慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26168360/

相关文章:

Android 自定义 EditText 在 ICS 中不显示光标

java - HTTP FAILED : java.net.SocketTimeoutException:新 Android gradle 超时

android - Facebook App 链接(深层链接)不适用于移动浏览器

angularjs - 如何加速 AngularJS 应用程序?

Facebook graph API 获取所有字段数据

android - 如何使 float 操作按钮背景渐变?

performance - 高效地反转 64 位字中 16 位数量的顺序

performance - Phpstorm 超慢 - 282.8% CPU 使用率

iphone - .plist 中的 Xcode4ExternalHosts

iphone - 在 iOS 版 PhoneGap 上接收推送通知