在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

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

问题描述

我从本教程.

它可以在小米Mix 2手机(Android版本8.0.0)和浏览器上运行,没有任何问题. 但是当我将其部署到三星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)

为什么会出现此错误?

任何建议都将受到赞赏.

Any advice and suggestions will be appreciated.

Kemal.

推荐答案

您的问题是由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 Web视图现在使用位于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天全站免登陆