在 android 4.4.2 版本上获取 net::ERR_CONNECTION_REFUSED (http://localhost:8080) [英] getting net::ERR_CONNECTION_REFUSED (http://localhost:8080) on android 4.4.2 version

查看:110
本文介绍了在 android 4.4.2 版本上获取 net::ERR_CONNECTION_REFUSED (http://localhost:8080)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 本教程.

它可以在小米 Mix 2 手机(android 版本 8.0.0)和浏览器上运行,没有任何问题.但是当我部署到 samsung note 2(android 版本 4.4.2)时,它给出了以下消息的应用程序错误:net::ERR_CONNECTION_REFUSED (http://localhost:8080)

It runs on Xiaomi Mix 2 phone (android version 8.0.0) and on browser without any problem. But when I deployed to the samsung note 2 (android version 4.4.2), it gives an application error with this message: net::ERR_CONNECTION_REFUSED (http://localhost:8080)

为什么我会收到此错误?

Why am I getting this error?

任何意见和建议将不胜感激.

Any advice and suggestions will be appreciated.

凯末尔.

推荐答案

您的问题是由 cordova-plugin-ionic-webview 插件引起的,该插件是每个新的或更新的 Ionic 应用程序的一部分.

Your problem is caused by the cordova-plugin-ionic-webview plugin that is part of every new or updated Ionic app.

这曾经仅适用于 iOS,它用 WKWebView 替换了 UIWebView,但在 2018 年 7 月 23 日,他们发布了插件的 2.0 版,其中还包括对 Android 上使用的 webview 的更改.

This used to apply only to iOS, where it replaced the UIWebView with WKWebView, but on July 23rd 2018 they released version 2.0 of the plugin, that also included changes to the webview used on Android.

Android webview 现在使用位于 localhost:8080 的本地网络服务器来显示您的应用程序,而不是直接从文件系统请求文件.

The Android webview now uses a local webserver at localhost:8080 to show your app instead of requesting the files directly from the file system.

不幸的是,此更改还在文档中包含了这一点:

Unfortunately this change also included this bit in the documentation:

Requirements
- […]
- Android: Android 5.0+ and cordova-android 6.4+

所以 cordova-plugin-ionic-webview 只是不再支持 5.0 之前的 Android,这当然意味着您的应用将无法在 Android 4.x 上运行.

So cordova-plugin-ionic-webview just doesn’t support Android earlier than 5.0 any more, which of course means your app will not work on Android 4.x.

一种解决方案是将插件降级到支持 Android 4.x 的最新版本:

One solution is to downgrade the plugin to the last version that supported Android 4.x:

ionic cordova plugin add cordova-plugin-ionic-webview@1.2.1

更详细的信息和替代解决方案:
https://ionic.zone/debug/ionic-and-android-4

More elaborate information and alternative solutions:
https://ionic.zone/debug/ionic-and-android-4

这篇关于在 android 4.4.2 版本上获取 net::ERR_CONNECTION_REFUSED (http://localhost:8080)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆