Vallo
Vallo

Reputation: 1967

Meteor Cordova Android app not connecting to server if server is running on VMware

I'm developing a Meteor Cordova app for Android. I want to test it in an Android phone, but it won't connect to server.

Dev environment is Ubuntu 18.04 running on VMware, host is Windows 10.

I deploy my app to my phone with

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

the app is installed correctly in my phone, but after it opens I get the error

Trying to connect, please ensure that you are connected to the internet

I've tried connecting with USB, through Wi-Fi and through USB PTP connection but in every case I get the same result.

VMware is configured on bridge mode. Ping from vmware to phone works.

Strange thing is that if I start another VMware instance running Android-x86 I can deploy the app there and it connects to my server.

Edit: I have spotted this log on adb logcat, not sure if relevant:

09-17 16:18:37.842 8148 9646 E ActivityTrigger: activityStartTrigger: not whiteListedcom.myApp.app/com.myApp.app.MainActivity/10001

Upvotes: 1

Views: 529

Answers (1)

Vallo
Vallo

Reputation: 1967

Connected through Chrome tool "remote devices" and spotted this log:

Failed to load resource: net::ERR_CLEARTEXT_NOT_PERMITTED

This code was needed on my mobile-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>
`);

Upvotes: 9

Related Questions