流星:热门代码推送在Android上生产中断

时间:2018-03-20 02:28:44

标签: javascript android cordova meteor

编辑:它适用于iOS,因此问题仅限于Android。

我刚刚发现,在我的Meteor制作应用程序中,Hot Code Push被破坏了。我不知道它何时开始发生,但这是事实(没有特别的顺序):

  • 当我将新二进制文件上传到Google Play / iOS App Store时,所有设备都会下载新版本
  • 当我仅更新服务器时,即使在应用中手动强制window.location.reload(),Android应用也不会更新。
  • 服务器更新后,在浏览器中应用程序将重新加载(到新版本)
  • https://myapp.com/__cordova/manifest.json应该是
  • 我在服务器上使用 mup 1.3.5
  • 在开发模式下(在localhost上)Hot Code Push完美运行
  • 在旧提交中使用 git checkout 并通过 meteor运行android-device --mobile-server https://myapp.com 在本地构建应用时可以看到以下控制台输出:

                Download failure
     com.meteor.webapp.WebAppException: Error downloading asset manifest
        at com.meteor.webapp.AssetBundleManager$1.onFailure(AssetBundleManager.java:97)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:140)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at java.lang.Thread.run(Thread.java:818)
     Caused by: java.net.ProtocolException: Expected ':status' header not present
        at okhttp3.internal.http.Http2xStream.readHttp2HeadersList(Http2xStream.java:266)
        at okhttp3.internal.http.Http2xStream.readResponseHeaders(Http2xStream.java:149)
        at okhttp3.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:723)
        at okhttp3.internal.http.HttpEngine.access$200(HttpEngine.java:81)
        at okhttp3.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:708)
        at okhttp3.internal.http.HttpEngine.readResponse(HttpEngine.java:563)
        at okhttp3.RealCall.getResponse(RealCall.java:241)
        at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:198)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:160)
        at okhttp3.RealCall.access$100(RealCall.java:30)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127)
        ... 4 more
     Download failure
     com.meteor.webapp.WebAppException: Error downloading asset manifest
        at com.meteor.webapp.AssetBundleManager$1.onFailure(AssetBundleManager.java:97)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:140)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at java.lang.Thread.run(Thread.java:818)
     Caused by: java.net.ProtocolException: Expected ':status' header not present
        at okhttp3.internal.http.Http2xStream.readHttp2HeadersList(Http2xStream.java:266)
        at okhttp3.internal.http.Http2xStream.readResponseHeaders(Http2xStream.java:149)
        at okhttp3.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:723)
        at okhttp3.internal.http.HttpEngine.access$200(HttpEngine.java:81)
        at okhttp3.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:708)
        at okhttp3.internal.http.HttpEngine.readResponse(HttpEngine.java:563)
        at okhttp3.RealCall.getResponse(RealCall.java:241)
        at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:198)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:160)
        at okhttp3.RealCall.access$100(RealCall.java:30)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127)
        ... 4 more
      "Error: Error downloading asset manifest", source: http://localhost:12128/packages/webapp.js?hash=e448c6ebb2384292f7c97e676471a51951a04169 (71)
    

这表明资产清单中缺少某种:status 标头。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

我在相同的控制台错误日志中遇到了同样的问题。使用Meteor 1.6.1和mup 1.4.3。最后,我通过使用:

升级cordova-plugin-meteor-webapp来修复它
meteor add cordova:cordova-plugin-meteor-webapp@1.6.0

然后重新部署。然后热门代码推送在Android上运行!

编辑:为了提供更多背景信息 - 我认为问题是由某些版本的nginx上的okhttp和HTTP / 2问题引起的。见this question。更新的cordova-plugin-meteor-webapp插件使用较新版本的okhttp。