如果服务器 运行 在 VMware 上,Meteor Cordova Android 应用程序无法连接到服务器
Meteor Cordova Android app not connecting to server if server is running on VMware
我正在为 Android 开发 Meteor Cordova 应用程序。我想在 Android phone 中测试它,但它无法连接到服务器。
VMware 上的开发环境是 Ubuntu 18.04 运行,主机是 Windows 10。
我使用
将我的应用程序部署到我的 phone
URL="http://192.168.0.6:3000"
export ROOT_URL=$URL;
export MOBILE_ROOT_URL=$URL;
export MOBILE_DDP_URL=$URL;
export DDP_DEFAULT_CONNECTION_URL=$URL;
meteor run android-device --settings "$DIR/settings.dev.json" --mobile-server $URL
应用程序在我的 phone 中正确安装,但在打开后出现错误
Trying to connect, please ensure that you are connected to the internet
我试过使用 USB、Wi-Fi 和 USB PTP 连接进行连接,但在每种情况下我都得到了相同的结果。
VMware 配置为桥接模式。从 vmware ping phone 有效。
奇怪的是,如果我启动另一个 VMware 实例 运行 Android-x86,我可以在那里部署该应用程序,它会连接到我的服务器。
编辑:我在 adb logcat 上发现了这个日志,不确定是否相关:
09-17 16:18:37.842 8148 9646 E ActivityTrigger: activityStartTrigger: not whiteListedcom.myApp.app/com.myApp.app.MainActivity/10001
通过 Chrome 工具 "remote devices" 连接并发现此日志:
Failed to load resource: net::ERR_CLEARTEXT_NOT_PERMITTED
我的手机需要此代码-config.js
App.appendToConfig(`
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:usesCleartextTraffic="true"></application>
</edit-config>
`);
我正在为 Android 开发 Meteor Cordova 应用程序。我想在 Android phone 中测试它,但它无法连接到服务器。
VMware 上的开发环境是 Ubuntu 18.04 运行,主机是 Windows 10。
我使用
将我的应用程序部署到我的 phoneURL="http://192.168.0.6:3000"
export ROOT_URL=$URL;
export MOBILE_ROOT_URL=$URL;
export MOBILE_DDP_URL=$URL;
export DDP_DEFAULT_CONNECTION_URL=$URL;
meteor run android-device --settings "$DIR/settings.dev.json" --mobile-server $URL
应用程序在我的 phone 中正确安装,但在打开后出现错误
Trying to connect, please ensure that you are connected to the internet
我试过使用 USB、Wi-Fi 和 USB PTP 连接进行连接,但在每种情况下我都得到了相同的结果。
VMware 配置为桥接模式。从 vmware ping phone 有效。
奇怪的是,如果我启动另一个 VMware 实例 运行 Android-x86,我可以在那里部署该应用程序,它会连接到我的服务器。
编辑:我在 adb logcat 上发现了这个日志,不确定是否相关:
09-17 16:18:37.842 8148 9646 E ActivityTrigger: activityStartTrigger: not whiteListedcom.myApp.app/com.myApp.app.MainActivity/10001
通过 Chrome 工具 "remote devices" 连接并发现此日志:
Failed to load resource: net::ERR_CLEARTEXT_NOT_PERMITTED
我的手机需要此代码-config.js
App.appendToConfig(`
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:usesCleartextTraffic="true"></application>
</edit-config>
`);