简体   繁体   English

调用函数更新App时Ionic Force App Update崩溃

[英]Ionic Force App Update crashes when calling the function to update the App

I have an Ionic 3 App that needs to use Force Update to all users of the App . 我有一个Ionic 3 App ,需要对该应用程序的所有用户使用“ 强制更新 ”。 I used this package called Ionic App Update . 我使用了名为Ionic App Update的程序包。 I created an small express server that will just serve the client for an updates. 我创建了一个小型快递服务器 ,该服务器仅用于为客户端提供更新。

Here is my code in my update.xml in the server or backend 这是我在服务器后端的 update.xml中的代码

<update>
    <version>0.0.2</version>
    <name>MyApp</name>
    <url>http://192.168.214.27:3346/public/android-debug.apk</url>
</update>

and in my server.js 并在我的server.js中

const express = require('express')
const app = express()
app.use('/public', express.static('public'))
app.get('/', (req, res) => {
    shell.exec('./update.sh')
})
app.listen(3336, () => {})

The server is working fine there is no errors 服务器工作正常, 没有错误

But when I try to call the function of the A pp Update plugin the device crashes every time. 但是,当我尝试调用A pp Update插件功能时 ,设备每次都崩溃。

Here is my code in my app.component.ts 这是我的app.component.ts中的代码

constructor() {
this.update()
}

update() {
    console.log('Update check')
    const updateUrl = 'http://192.168.214.27:3346/public/update.xml';
    this.appUpdate.checkAppUpdate(updateUrl).then(() => { console.log('Update available') }).catch(err => {
      console.log(err)
      console.log('No update')
    });
  }

I am calling the update function every time the app component constructor is initialize. 每次初始化应用程序组件构造函数时,我都会调用update函数。

But when I call the function the app crashes 但是当我调用该函数时应用程序崩溃了

Is this more of an android version issue or what? 这更多是android版本问题还是什么?

Appreciate if someone could help. 感谢有人可以帮忙。 Thanks in advance. 提前致谢。

This line <version>0.0.2</version> seems to be the problem. 这行<version>0.0.2</version>似乎是问题所在。 This isn't the format for android version numbers. 这不是android版本号的格式。 As per cordova's documentation it is 根据科尔多瓦的文件

Expressed in major/minor/patch notation. 以主要/次要/补丁符号表示。

For example version 30.20.48 would be written as 302048. 例如,版本30.20.48将写为302048。

Read More: config.xml - https://cordova.apache.org/docs/en/latest/config_ref/ Android Platform Guide - https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#setting-the-version-code 阅读更多:config.xml中- https://cordova.apache.org/docs/en/latest/config_ref/的Android平台指南- https://cordova.apache.org/docs/en/latest/guide/platforms/android /index.html#setting-the-version-code

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM