jxcore / jxcore-cordova

JXcore / Node.JS plugin for Apache Cordova / PhoneGap
Other
233 stars 68 forks source link

Express Application Issues with Android Cordova #10

Closed DLLarson closed 9 years ago

DLLarson commented 9 years ago

Continuing from here: jxcore/jxcore/issues/298

JXcore cordova plugin for Android is ready. Please see if this issue is fixed there.

I'm found some time to get back at this.

I've added our application to the JXCore plug-in folder and started the application up on an android emulator.

Here is the log from Android:

05-13 11:03:08.468: I/CordovaLog(4967): Changing log level to DEBUG(3)
05-13 11:03:08.500: I/WebViewFactory(4967): Loading com.android.webview version 37 (eng.buildbot-x86) (code 199997)
05-13 11:03:08.504: I/LibraryLoader(4967): Loading: webviewchromium
05-13 11:03:08.507: I/LibraryLoader(4967): Time to load native libraries: 3 ms (timestamps 4211-4214)
05-13 11:03:08.507: I/LibraryLoader(4967): Expected native library version number "",actual native library version number ""
05-13 11:03:08.518: V/WebViewChromiumFactoryProvider(4967): Binding Chromium to main looper Looper (main, tid 1) {2f8a5209}
05-13 11:03:08.519: I/LibraryLoader(4967): Expected native library version number "",actual native library version number ""
05-13 11:03:08.519: I/chromium(4967): [INFO:library_loader_hooks.cc(106)] Chromium logging enabled: level = 0, default verbosity = 0
05-13 11:03:08.523: I/BrowserStartupController(4967): Initializing chromium process, renderers=0
05-13 11:03:08.524: W/art(4967): Attempt to remove local handle scope entry from IRT, ignoring
05-13 11:03:08.531: W/chromium(4967): [WARNING:resource_bundle.cc(315)] locale_file_path.empty()
05-13 11:03:08.532: W/AudioManagerAndroid(4967): Requires BLUETOOTH permission
05-13 11:03:08.532: I/chromium(4967): [INFO:aw_browser_main_parts.cc(63)] Load from apk succesful, fd=32 off=46092 len=2953
05-13 11:03:08.532: I/chromium(4967): [INFO:aw_browser_main_parts.cc(78)] Loading webviewchromium.pak from, fd:33 off:228796 len:643667
05-13 11:03:08.565: D/libEGL(4967): loaded /system/lib/egl/libEGL_emulation.so
05-13 11:03:08.565: D/libEGL(4967): loaded /system/lib/egl/libGLESv1_CM_emulation.so
05-13 11:03:08.570: D/libEGL(4967): loaded /system/lib/egl/libGLESv2_emulation.so
05-13 11:03:08.579: D/(4967): HostConnection::get() New Host Connection established 0xabcaa2e0, tid 4967
05-13 11:03:08.712: W/chromium(4967): [WARNING:mailbox_synchronizer.cc(36)] MailboxSync not supported due to missing EGL image/fence support
05-13 11:03:08.729: W/chromium(4967): [WARNING:proxy_service.cc(901)] PAC support disabled because there is no system implementation
05-13 11:03:08.730: W/chromium(4967): [WARNING:data_reduction_proxy_settings.cc(403)] SPDY proxy OFF at startup
05-13 11:03:08.736: W/art(4967): Attempt to remove local handle scope entry from IRT, ignoring
05-13 11:03:08.738: W/AwContents(4967): onDetachedFromWindow called when already detached. Ignoring
05-13 11:03:08.744: D/SystemWebViewEngine(4967): CordovaWebView is running on device made by: Genymotion
05-13 11:03:08.747: W/art(4967): Attempt to remove local handle scope entry from IRT, ignoring
05-13 11:03:08.748: W/art(4967): Attempt to remove local handle scope entry from IRT, ignoring
05-13 11:03:08.748: D/PluginManager(4967): init()
05-13 11:03:08.749: D/CordovaWebViewImpl(4967): >>> loadUrl(file:///android_asset/www/index.html)
05-13 11:03:08.764: D/CordovaActivity(4967): Started the activity.
05-13 11:03:08.764: D/CordovaActivity(4967): Resumed the activity.
05-13 11:03:08.791: D/OpenGLRenderer(4967): Render dirty regions requested: true
05-13 11:03:08.795: D/Atlas(4967): Validating map...
05-13 11:03:08.844: I/OpenGLRenderer(4967): Initialized EGL, version 1.4
05-13 11:03:08.849: D/(4967): HostConnection::get() New Host Connection established 0xaf80bd60, tid 5014
05-13 11:03:08.909: D/OpenGLRenderer(4967): Enabling debug mode 0
05-13 11:03:08.988: W/EGL_emulation(4967): eglSurfaceAttrib not implemented
05-13 11:03:08.988: W/OpenGLRenderer(4967): Failed to set EGL_SWAP_BEHAVIOR on surface 0xaf838b60, error=EGL_SUCCESS
05-13 11:03:09.584: D/CordovaWebViewImpl(4967): onPageDidNavigate(file:///android_asset/www/index.html)
05-13 11:03:09.598: E/AndroidProtocolHandler(4967): Unable to open asset URL: file:///android_asset/www/jxcore.js
05-13 11:03:09.633: D/SystemWebChromeClient(4967): file:///android_asset/www/index.html: Line 9 : The key "target-densitydpi" is not supported.
05-13 11:03:09.633: I/chromium(4967): [INFO:CONSOLE(9)] "The key "target-densitydpi" is not supported.", source: file:///android_asset/www/index.html (9)
05-13 11:03:09.634: D/JsMessageQueue(4967): Set native->JS mode to OnlineEventsBridgeMode
05-13 11:03:10.019: D/SystemWebChromeClient(4967): file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js: Line 23 : No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.
05-13 11:03:10.019: I/chromium(4967): [INFO:CONSOLE(23)] "No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.", source: file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js (23)
05-13 11:03:11.088: D/SystemWebChromeClient(4967): file:///android_asset/www/cordova.js: Line 927 : Uncaught TypeError: Cannot read property 'length' of null
05-13 11:03:11.088: I/chromium(4967): [INFO:CONSOLE(927)] "Uncaught TypeError: Cannot read property 'length' of null", source: file:///android_asset/www/cordova.js (927)
05-13 11:03:11.093: D/jxcore_app_log(4967): JniHelper::setJavaVM(0xb4681200), pthread_self() = -1412557440
05-13 11:03:11.093: D/JX-Cordova(4967): jxcore cordova android initializing
05-13 11:03:11.287: W/jxcore-log(4967): Initializing JXcore engine
05-13 11:03:11.287: W/jxcore-log(4967): JXcore engine is ready
05-13 11:03:11.289: W/jxcore-log(4967): Starting JXcore engine
05-13 11:03:11.334: E/jxcore-log(4967): Platform android
05-13 11:03:11.432: I/jxcore-log(4967): JXcore Cordova Bridge is Ready!
05-13 11:03:11.432: W/jxcore-log(4967): JXcore engine is started
05-13 11:03:11.437: I/jxcore-log(4967): loadMainFile app.js
05-13 11:03:11.594: E/jxcore-log(4967): loadMainFile { [Error: ENOENT, no such file or directory '/data/data/com.jci.mapgw/files/node_modules/express/node_modules/connect/lib/middleware']
05-13 11:03:11.594: E/jxcore-log(4967):   message: 'ENOENT, no such file or directory \'/data/data/com.jci.mapgw/files/node_modules/express/node_modules/connect/lib/middleware\'',
05-13 11:03:11.594: E/jxcore-log(4967):   errno: 34,
05-13 11:03:11.594: E/jxcore-log(4967):   code: 'ENOENT',
05-13 11:03:11.594: E/jxcore-log(4967):   path: '/data/data/com.jci.mapgw/files/node_modules/express/node_modules/connect/lib/middleware',
05-13 11:03:11.594: E/jxcore-log(4967):   syscall: 'readdir' }
05-13 11:03:11.594: W/PluginManager(4967): THREAD WARNING: exec() call to JXcore.Evaluate blocked the main thread for 159ms. Plugin should use CordovaInterface.getThreadPool().
05-13 11:03:11.640: W/EGL_emulation(4967): eglSurfaceAttrib not implemented
05-13 11:03:11.640: W/OpenGLRenderer(4967): Failed to set EGL_SWAP_BEHAVIOR on surface 0xa1d48680, error=EGL_SUCCESS
05-13 11:03:25.473: D/CordovaWebViewImpl(4967): onPageFinished(file:///android_asset/www/index.html)
05-13 11:03:28.478: D/SystemWebChromeClient(4967): file:///android_asset/www/cordova.js: Line 1185 : deviceready has not fired after 5 seconds.
05-13 11:03:28.478: I/chromium(4967): [INFO:CONSOLE(1185)] "deviceready has not fired after 5 seconds.", source: file:///android_asset/www/cordova.js (1185)
05-13 11:03:28.478: D/SystemWebChromeClient(4967): file:///android_asset/www/cordova.js: Line 1178 : Channel not fired: onJXcoreReady
05-13 11:03:28.478: I/chromium(4967): [INFO:CONSOLE(1178)] "Channel not fired: onJXcoreReady", source: file:///android_asset/www/cordova.js (1178)
05-13 11:03:33.525: D/SystemWebChromeClient(4967): file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js: Line 25 : No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.
05-13 11:03:33.525: I/chromium(4967): [INFO:CONSOLE(25)] "No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.", source: file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js (25)
05-13 11:03:43.526: D/SystemWebChromeClient(4967): file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js: Line 25 : No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.
05-13 11:03:43.526: I/chromium(4967): [INFO:CONSOLE(25)] "No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.", source: file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js (25)
05-13 11:03:53.526: D/SystemWebChromeClient(4967): file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js: Line 25 : No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.
05-13 11:03:53.526: I/chromium(4967): [INFO:CONSOLE(25)] "No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.", source: file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js (25)
05-13 11:04:03.527: D/SystemWebChromeClient(4967): file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js: Line 25 : No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.
05-13 11:04:03.527: I/chromium(4967): [INFO:CONSOLE(25)] "No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.", source: file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js (25)
05-13 11:04:13.529: D/SystemWebChromeClient(4967): file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js: Line 25 : No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.
:
:
05-13 11:12:23.559: I/chromium(4967): [INFO:CONSOLE(25)] "No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.", source: file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js (25)
05-13 11:12:33.560: D/SystemWebChromeClient(4967): file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js: Line 25 : No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.
05-13 11:12:33.560: I/chromium(4967): [INFO:CONSOLE(25)] "No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.", source: file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js (25)
05-13 11:12:43.560: D/SystemWebChromeClient(4967): file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js: Line 25 : No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.
05-13 11:12:43.560: I/chromium(4967): [INFO:CONSOLE(25)] "No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.", source: file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js (25)
05-13 11:12:53.561: D/SystemWebChromeClient(4967): file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js: Line 25 : No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.
05-13 11:12:53.561: I/chromium(4967): [INFO:CONSOLE(25)] "No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.", source: file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js (25)
05-13 11:12:58.953: D/CordovaActivity(4967): Paused the activity.
05-13 11:12:58.963: D/SystemWebChromeClient(4967): file:///android_asset/www/cordova.js: Line 927 : Uncaught TypeError: Cannot read property 'length' of undefined
05-13 11:12:58.963: I/chromium(4967): [INFO:CONSOLE(927)] "Uncaught TypeError: Cannot read property 'length' of undefined", source: file:///android_asset/www/cordova.js (927)
05-13 11:12:58.966: D/CordovaActivity(4967): Stopped the activity.
05-13 11:12:59.148: W/IInputConnectionWrapper(4967): showStatusIcon on inactive InputConnection

While loading the app.js it can't seem to find a directory but it definitely exists. My familiarity with Cordova is pretty low so I could be messing up the basics.

My current checkout of jxcore-cordova is today's (2459592845f3605b).

-Dale

obastemur commented 9 years ago

@DLLarson I've tried to update the docs. Could you please check README and see if you skipped something?

DLLarson commented 9 years ago

OK... I think I'm doing stuff right but I'll reduce it down to something simple to test my understanding.

First the sanity check... Here's what I did using the sample in jxcore-cordova:

cordova create mapgw com.jci.mapgw MapGW
cd mapgw
git clone https://github.com/jxcore/jxcore-cordova.git
cp jxcore-cordova/sample/www/index.html www/
cp -a jxcore-cordova/sample/jxcore_app/* jxcore-cordova/io.jxcore.node/app/jxcore/
cordova plugin add jxcore-cordova/io.jxcore.node/
cordova platform add android
cordova build
cordova emulate android

I see this on the emulator:

image

And for completeness here is the Android log:

05-13 13:56:40.148: I/WebViewFactory(6361): Loading com.android.webview version 37 (eng.buildbot-x86) (code 199997)
05-13 13:56:40.153: I/LibraryLoader(6361): Loading: webviewchromium
05-13 13:56:40.154: I/LibraryLoader(6361): Time to load native libraries: 1 ms (timestamps 5860-5861)
05-13 13:56:40.154: I/LibraryLoader(6361): Expected native library version number "",actual native library version number ""
05-13 13:56:40.163: V/WebViewChromiumFactoryProvider(6361): Binding Chromium to main looper Looper (main, tid 1) {1ed9dc0e}
05-13 13:56:40.164: I/LibraryLoader(6361): Expected native library version number "",actual native library version number ""
05-13 13:56:40.164: I/chromium(6361): [INFO:library_loader_hooks.cc(106)] Chromium logging enabled: level = 0, default verbosity = 0
05-13 13:56:40.167: I/BrowserStartupController(6361): Initializing chromium process, renderers=0
05-13 13:56:40.167: W/art(6361): Attempt to remove local handle scope entry from IRT, ignoring
05-13 13:56:40.177: W/AudioManagerAndroid(6361): Requires BLUETOOTH permission
05-13 13:56:40.177: W/chromium(6361): [WARNING:resource_bundle.cc(315)] locale_file_path.empty()
05-13 13:56:40.178: I/chromium(6361): [INFO:aw_browser_main_parts.cc(63)] Load from apk succesful, fd=32 off=46092 len=2953
05-13 13:56:40.178: I/chromium(6361): [INFO:aw_browser_main_parts.cc(78)] Loading webviewchromium.pak from, fd:33 off:228796 len:643667
05-13 13:56:40.197: D/libEGL(6361): loaded /system/lib/egl/libEGL_emulation.so
05-13 13:56:40.197: D/libEGL(6361): loaded /system/lib/egl/libGLESv1_CM_emulation.so
05-13 13:56:40.202: D/libEGL(6361): loaded /system/lib/egl/libGLESv2_emulation.so
05-13 13:56:40.209: D/(6361): HostConnection::get() New Host Connection established 0xabc82c50, tid 6361
05-13 13:56:40.279: W/chromium(6361): [WARNING:mailbox_synchronizer.cc(36)] MailboxSync not supported due to missing EGL image/fence support
05-13 13:56:40.294: W/chromium(6361): [WARNING:proxy_service.cc(901)] PAC support disabled because there is no system implementation
05-13 13:56:40.296: W/chromium(6361): [WARNING:data_reduction_proxy_settings.cc(403)] SPDY proxy OFF at startup
05-13 13:56:40.304: W/art(6361): Attempt to remove local handle scope entry from IRT, ignoring
05-13 13:56:40.306: W/AwContents(6361): onDetachedFromWindow called when already detached. Ignoring
05-13 13:56:40.314: D/SystemWebViewEngine(6361): CordovaWebView is running on device made by: Genymotion
05-13 13:56:40.319: W/art(6361): Attempt to remove local handle scope entry from IRT, ignoring
05-13 13:56:40.319: W/art(6361): Attempt to remove local handle scope entry from IRT, ignoring
05-13 13:56:40.319: D/PluginManager(6361): init()
05-13 13:56:40.320: D/CordovaWebViewImpl(6361): >>> loadUrl(file:///android_asset/www/index.html)
05-13 13:56:40.331: D/CordovaActivity(6361): Started the activity.
05-13 13:56:40.331: D/CordovaActivity(6361): Resumed the activity.
05-13 13:56:40.337: D/OpenGLRenderer(6361): Render dirty regions requested: true
05-13 13:56:40.349: D/Atlas(6361): Validating map...
05-13 13:56:40.441: I/OpenGLRenderer(6361): Initialized EGL, version 1.4
05-13 13:56:40.441: D/(6361): HostConnection::get() New Host Connection established 0xaf50be00, tid 6405
05-13 13:56:40.501: D/OpenGLRenderer(6361): Enabling debug mode 0
05-13 13:56:40.568: W/EGL_emulation(6361): eglSurfaceAttrib not implemented
05-13 13:56:40.568: W/OpenGLRenderer(6361): Failed to set EGL_SWAP_BEHAVIOR on surface 0xaf551900, error=EGL_SUCCESS
05-13 13:56:40.701: E/AndroidProtocolHandler(6361): Unable to open asset URL: file:///android_asset/www/jxcore.js
05-13 13:56:40.742: D/CordovaWebViewImpl(6361): onPageDidNavigate(file:///android_asset/www/index.html)
05-13 13:56:40.744: D/SystemWebChromeClient(6361): file:///android_asset/www/index.html: Line 9 : The key "target-densitydpi" is not supported.
05-13 13:56:40.744: I/chromium(6361): [INFO:CONSOLE(9)] "The key "target-densitydpi" is not supported.", source: file:///android_asset/www/index.html (9)
05-13 13:56:40.745: D/JsMessageQueue(6361): Set native->JS mode to OnlineEventsBridgeMode
05-13 13:56:40.760: D/CordovaWebViewImpl(6361): onPageFinished(file:///android_asset/www/index.html)
05-13 13:56:40.772: D/SystemWebChromeClient(6361): file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js: Line 23 : No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.
05-13 13:56:40.772: I/chromium(6361): [INFO:CONSOLE(23)] "No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.", source: file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js (23)
05-13 13:56:40.783: D/SystemWebChromeClient(6361): file:///android_asset/www/cordova.js: Line 927 : Uncaught TypeError: Cannot read property 'length' of null
05-13 13:56:40.783: I/chromium(6361): [INFO:CONSOLE(927)] "Uncaught TypeError: Cannot read property 'length' of null", source: file:///android_asset/www/cordova.js (927)
05-13 13:56:40.787: D/jxcore_app_log(6361): JniHelper::setJavaVM(0xb4681200), pthread_self() = -1413323136
05-13 13:56:40.787: D/JX-Cordova(6361): jxcore cordova android initializing
05-13 13:56:40.788: W/jxcore-log(6361): Initializing JXcore engine
05-13 13:56:40.788: W/jxcore-log(6361): JXcore engine is ready
05-13 13:56:40.789: W/jxcore-log(6361): Starting JXcore engine
05-13 13:56:40.831: E/jxcore-log(6361): Platform android
05-13 13:56:40.831: I/jxcore-log(6361): JXcore Cordova Bridge is Ready!
05-13 13:56:40.831: W/jxcore-log(6361): JXcore engine is started
05-13 13:56:40.836: I/jxcore-log(6361): loadMainFile app.js
05-13 13:56:40.845: I/jxcore-log(6361): {
05-13 13:56:40.845: I/jxcore-log(6361):   "a": 1,
05-13 13:56:40.845: I/jxcore-log(6361):   "b": 2
05-13 13:56:40.845: I/jxcore-log(6361): }
05-13 13:56:40.845: I/jxcore-log(6361): execPath /data/data/com.jci.mapgateway/files
05-13 13:56:40.845: I/jxcore-log(6361): process.cwd /data/data/com.jci.mapgateway/files
05-13 13:56:40.845: I/jxcore-log(6361): userPath []
05-13 13:56:40.846: E/jxcore-app-log(6361): JNI, number of params 2
05-13 13:56:40.846: I/jxcore-log(6361): Size 800 1216
05-13 13:56:40.847: E/jxcore-app-log(6361): JNI, number of params 1
05-13 13:56:40.847: I/jxcore-log(6361): Screen Brightness 102
05-13 13:56:41.432: I/jxcore-log(6361): getBuffer is called!!!
05-13 13:56:41.495: W/PluginManager(6361): THREAD WARNING: exec() call to JXcore.Evaluate blocked the main thread for 62ms. Plugin should use CordovaInterface.getThreadPool().
05-13 13:56:45.738: D/SystemWebChromeClient(6361): file:///android_asset/www/cordova.js: Line 1185 : deviceready has not fired after 5 seconds.
05-13 13:56:45.738: I/chromium(6361): [INFO:CONSOLE(1185)] "deviceready has not fired after 5 seconds.", source: file:///android_asset/www/cordova.js (1185)
05-13 13:56:45.738: D/SystemWebChromeClient(6361): file:///android_asset/www/cordova.js: Line 1178 : Channel not fired: onJXcoreReady
05-13 13:56:45.738: I/chromium(6361): [INFO:CONSOLE(1178)] "Channel not fired: onJXcoreReady", source: file:///android_asset/www/cordova.js (1178)
05-13 13:56:47.421: D/CordovaActivity(6361): Paused the activity.
05-13 13:56:47.427: D/SystemWebChromeClient(6361): file:///android_asset/www/cordova.js: Line 927 : Uncaught TypeError: Cannot read property 'length' of undefined
05-13 13:56:47.427: I/chromium(6361): [INFO:CONSOLE(927)] "Uncaught TypeError: Cannot read property 'length' of undefined", source: file:///android_asset/www/cordova.js (927)
05-13 13:56:47.427: D/CordovaActivity(6361): Stopped the activity.
05-13 13:56:47.627: W/IInputConnectionWrapper(6361): showStatusIcon on inactive InputConnection

Now I'll try a boilerplate Express app. Again I'll start with a clean slate:

cordova create mapgw com.jci.mapgw MapGW
cd mapgw
git clone https://github.com/jxcore/jxcore-cordova.git
cp jxcore-cordova/sample/www/index.html www/

#### Edit www/index.html like so:
vim www/index.html
#### Change 'app.js' to 'bin/www.js'
#### Insert after the "jxcore('bin/www.js').loadMainFile(function (ret, err) {" decision block:
window.location = "http://127.0.0.1:3000";

cd jxcore-cordova/io.jxcore.node/app/jxcore/
#### Generate express boilerplate app...
express -f
#### Edit bin/www to remove shebang (line 1):
vim bin/www
#### Rename www to www.js as is required.
mv bin/www bin/www.js

npm install

cordova plugin add jxcore-cordova/io.jxcore.node/
cordova platform add android
cordova build
cordova emulate android

On the emulator I see this:

image

Followed by this:

image

Here are the Android logs for this test:

05-13 14:50:15.718: D/SystemWebChromeClient(7118): file:///android_asset/www/index.html: Line 9 : The key "target-densitydpi" is not supported.
05-13 14:50:15.718: I/chromium(7118): [INFO:CONSOLE(9)] "The key "target-densitydpi" is not supported.", source: file:///android_asset/www/index.html (9)
05-13 14:50:15.719: D/JsMessageQueue(7118): Set native->JS mode to OnlineEventsBridgeMode
05-13 14:50:15.735: D/CordovaWebViewImpl(7118): onPageFinished(file:///android_asset/www/index.html)
05-13 14:50:15.951: D/SystemWebChromeClient(7118): file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js: Line 23 : No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.
05-13 14:50:15.951: I/chromium(7118): [INFO:CONSOLE(23)] "No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.", source: file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js (23)
05-13 14:50:17.089: D/SystemWebChromeClient(7118): file:///android_asset/www/cordova.js: Line 927 : Uncaught TypeError: Cannot read property 'length' of null
05-13 14:50:17.089: I/chromium(7118): [INFO:CONSOLE(927)] "Uncaught TypeError: Cannot read property 'length' of null", source: file:///android_asset/www/cordova.js (927)
05-13 14:50:17.094: D/jxcore_app_log(7118): JniHelper::setJavaVM(0xb4681200), pthread_self() = -1413340416
05-13 14:50:17.094: D/JX-Cordova(7118): jxcore cordova android initializing
05-13 14:50:17.130: W/jxcore-log(7118): Initializing JXcore engine
05-13 14:50:17.130: W/jxcore-log(7118): JXcore engine is ready
05-13 14:50:17.132: W/jxcore-log(7118): Starting JXcore engine
05-13 14:50:17.190: E/jxcore-log(7118): Platform android
05-13 14:50:17.201: I/jxcore-log(7118): JXcore Cordova Bridge is Ready!
05-13 14:50:17.201: W/jxcore-log(7118): JXcore engine is started
05-13 14:50:17.206: I/jxcore-log(7118): loadMainFile bin/www.js
05-13 14:50:17.643: E/jxcore-log(7118): loadMainFile { [Error: ENOENT, no such file or directory '/data/data/com.jci.mapgw/files/node_modules/body-parser/lib/types']
05-13 14:50:17.643: E/jxcore-log(7118):   message: 'ENOENT, no such file or directory \'/data/data/com.jci.mapgw/files/node_modules/body-parser/lib/types\'',
05-13 14:50:17.643: E/jxcore-log(7118):   errno: 34,
05-13 14:50:17.643: E/jxcore-log(7118):   code: 'ENOENT',
05-13 14:50:17.643: E/jxcore-log(7118):   path: '/data/data/com.jci.mapgw/files/node_modules/body-parser/lib/types',
05-13 14:50:17.643: E/jxcore-log(7118):   syscall: 'readdir' }
05-13 14:50:17.643: W/PluginManager(7118): THREAD WARNING: exec() call to JXcore.Evaluate blocked the main thread for 439ms. Plugin should use CordovaInterface.getThreadPool().
05-13 14:50:17.693: W/EGL_emulation(7118): eglSurfaceAttrib not implemented
05-13 14:50:17.693: W/OpenGLRenderer(7118): Failed to set EGL_SWAP_BEHAVIOR on surface 0xa1d2c460, error=EGL_SUCCESS
05-13 14:50:27.795: D/CordovaWebViewImpl(7118): showWebPage(http://127.0.0.1:3000/, true, false, HashMap)
05-13 14:50:27.882: D/CordovaActivity(7118): Paused the activity.
05-13 14:50:27.980: D/SystemWebChromeClient(7118): file:///android_asset/www/cordova.js: Line 927 : Uncaught TypeError: Cannot read property 'length' of undefined
05-13 14:50:27.980: I/chromium(7118): [INFO:CONSOLE(927)] "Uncaught TypeError: Cannot read property 'length' of undefined", source: file:///android_asset/www/cordova.js (927)
05-13 14:50:28.833: W/IInputConnectionWrapper(7118): showStatusIcon on inactive InputConnection
05-13 14:50:30.669: D/CordovaActivity(7118): Stopped the activity.
05-13 14:50:30.860: D/SystemWebChromeClient(7118): file:///android_asset/www/cordova.js: Line 1185 : deviceready has not fired after 5 seconds.
05-13 14:50:30.860: I/chromium(7118): [INFO:CONSOLE(1185)] "deviceready has not fired after 5 seconds.", source: file:///android_asset/www/cordova.js (1185)
05-13 14:50:30.861: D/SystemWebChromeClient(7118): file:///android_asset/www/cordova.js: Line 1178 : Channel not fired: onJXcoreReady
05-13 14:50:30.861: I/chromium(7118): [INFO:CONSOLE(1178)] "Channel not fired: onJXcoreReady", source: file:///android_asset/www/cordova.js (1178)
05-13 14:50:35.897: D/SystemWebChromeClient(7118): file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js: Line 25 : No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.
05-13 14:50:35.897: I/chromium(7118): [INFO:CONSOLE(25)] "No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.", source: file:///android_asset/www/plugins/cordova-plugin-whitelist/whitelist.js (25)

I still see the issues finding files during load. No joy on the Express app.

Note: I also just tried the express app using jxcore directly:

jx bin/www.js

And I can open it in a browser on port 3000.

-Dale

ktrzeciaknubisa commented 9 years ago

@DLLarson I was following your steps, but I'm lost with the boilerplate part:

#### Generate express boilerplate app...
express -f

Is there any package, that I need to run this?

DLLarson commented 9 years ago

Hi,

It's a tool from npm:

npm install -g express-generator

should get it set up.

-Dale

ktrzeciaknubisa commented 9 years ago

Thanks!

Here is what I saw:

  1. if you'll replace alert(err) with alert(JSON.stringify(err)) in index.html, you should see the exact problem.
  2. Basically I was able to repeat your steps and start the cordova app android, with express server as well (it starts listening) but then it fails to process the very first http request (I've checked from desktop browser too). See 3.
  3. So I've tried to run this express app on desktop machine with jx bin/www.js and it works only with V8 build, while for SM it fails on first request from the browser:
DEBUG: ERROR in file: /Users/nubisa_krzs/Documents/temp/xc10/mapgw/platforms/android/assets/jxcore/node_modules/jade/node_modules/transformers/node_modules/uglify-js/lib/parse.js / Error: Uncaught exception at /Users/nubisa_krzs/Documents/temp/xc10/mapgw/platforms/android/assets/jxcore/node_modules/jade/node_modules/transformers/node_modules/uglify-js/lib/parse.js
    words.split is not a function

I did not go further into that, yet.

I was not able yet to replace binaries with V8 build in cordova app (it runs with SM build), but we should be able to find out soon how to do it: jxcore-cordova#12.

DLLarson commented 9 years ago

I see.

I've always used the V8 because that's what Node.js does. Hence some level of inter-operational compatibility is there.

My few forays into using SM always had worse outcomes than v8.

I did notice the Cordova SM dependency though. I just couldn't find build instructions for interposing my own binaries.

-Dale

ktrzeciaknubisa commented 9 years ago

I just couldn't find build instructions for interposing my own binaries.

Well, I've just added a note: Updating JXcore binaries. But still, that will work only for SM builds.

You can also refer to jxcore/issues#331.

obastemur commented 9 years ago

My few forays into using SM always had worse outcomes than v8.

@DLLarson I admit It took some time for us to carry SM build into something usable. Thanks to you and others we saw and solved lots of issues. I feel pretty comfortable using SM nowadays. There will be some minor issues though but they are nothing but minor bugs to fix.

I believe at the end of the day you will need to protect the naked js files of your mobile application from curious eyes. Unfortunately encryption and obfuscation are the only options we have with V8. SpiderMonkey gives us much more opportunity here. This is on of the important benefits from multiple engine support. Take what you find best.

Still. We do support both engines and V8 build is also passing against the jx-ni tests. Once you replace them and reconfigure compile scripts for cordova plugin, they will just work fine.

/cc @plika we may need a wiki page etc. showing how to do this.

JoeKan commented 9 years ago

@obastemur I tried the latest commit on android after following the new guidelines in the Readme. The method asyncPing is not getting called from index.html, although commenting the method declaration result in the console-message: "Method Doesn't Exist [ asyncPing ] Did you register it?"

Plus, a simple express server used to work, I wonder why not now! the browser just freezes.

obastemur commented 9 years ago

@JoeKan I assume you have Cordova 5.0 installed or you forgot moving node_modules folder or previous app installation mixes up the assets. No worries. Just update to latest and they are all taken care of.

DLLarson commented 9 years ago

Hi,

Still. We do support both engines and V8 build is also passing against the jx-ni tests. Once you >replace them and reconfigure compile scripts for cordova plugin, they will just work fine.

So I'm unclear as to where I'm at with my issue.

Is this back in my court? If so, I seem to be missing what I should do.

-Dale

obastemur commented 9 years ago

@DLLarson If it doesn't take much time, could you please try your scenario again with the current SM build. You don't need to compile JXcore. Just update to latest plugin and follow up the steps from README.md to install the plugin.

DLLarson commented 9 years ago

Hi...

I will give that a try!

-Dale

deefactorial commented 9 years ago

I have started a jxcore-cordova-tests project to do integration tests for the jxcore-cordova project currently I have 97 mocha tests passing using express server. If you have an example you would like to add please send me a PR.

JimSEOW commented 9 years ago

I follow the steps and I manage to deploy to Genymotion and run the express sample.

I am attempting to develop using visual studio 2015 RC environment. It deploys but does not run in Genymotion. Error message window is illegal path. Has anyone attempted to develop in Visual studio 2015 RC?

Visual studo 2015RC provides an option to install custom plugin using https://github.com/jxcore/jxcore-cordova.git, I am not able to install through visual studio.

I am still learning cordova and trying to figure out my way around.

obastemur commented 9 years ago

@Davtomas I really appreciate if you can open a new issue with VS2015RC problem you had. I'm closing this one since there is nothing further to discuss on express support ATM. Thanks for all the inputs