Cannot initialize app on localhost

0
I’ve followed the instructions on https://docs.mendix.com/howto/mobile/debug-a-mobile-app#6-android-windows-a-name-androidandwindows-a to install my hybrid app locally.  I’m able to download and launch the apk generated by PhoneGap and I can see my Android device from my computer’s Chrome.  But when launching the app, I get “Cannot initialize app.”. Debugger provides the following explanation:    bundle.js:formatted:3555 Error: Failed to sync and startup. at Object.<anonymous> (bundle.js:formatted:3643) at r (bundle.js:formatted:6931) at Generator._invoke (bundle.js:formatted:7011) at Generator.t.<computed> [as throw] (bundle.js:formatted:6946) at r (bundle.js:formatted:2826) at bundle.js:formatted:2835 (anonymous) @ bundle.js:formatted:1 192.168.86.112:8080/components.json?1588945794787:1 Failed to load resource: net::ERR_SSL_PROTOCOL_ERROR DevTools failed to load SourceMap: Could not load content for file:///android_asset/www/js/bundle.js.map: System error: net::ERR_FILE_NOT_FOUND My computer has no firewall and the phone is able to ping it.  The weird thing, though, is that the url the debugging tool refers is in https although the url that I’ve setup in settings.json is in http. My guess is that some setting forces the app to access https addresses, which won’t work with my computer.  Any idea?
asked
1 answers
0

Hello Patrick

Today we had the same problem. We could not deploy a excisting Android test app on a new Android 10 phone. The test app points to the local host IP adress ( e.g. http://192:168.1.10:8080 ) where the Mendix modeller is running. The test app works on other Android phones, but not on this phone. It took us a couple of hours to figure out why. (We are using Mendix 7, and test app excist already for almost 2 years)

 

This stackoverflow topic gave us the right direction to solve it. https://stackoverflow.com/questions/54752716/why-am-i-seeing-neterr-cleartext-not-permitted-errors-after-upgrading-to-cordo. For the local test server, you are using HTTP (for Mendix cloud HTTPS). As of Android 9, clear text communication (= HTTP) from a APP is disabled by default. To Allow HTTP, the useClearTextTrafic should be set activly to true.

 

The following should be added to your config.xml file within the Android Platform scope,

 <splash src="res/android/screen-xxxhdpi-portrait.png" density="port-xxxhdpi"/>
                   <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
                       <application android:usesCleartextTraffic="true" />
                    </edit-config>

And the following should be added to the top op your config.xml file (see also the stackoverflow toppic)

xmlns:android="http://schemas.android.com/apk/res/android"      

Hope this help you and others solving the issue of not getting a test app running with the error cannot initialized app on Android 9/ Android 10 phones. 

 

 

 

answered