I am developing a Cordova plugin that is going to perform liveness verification of the user (using firebase ML for Android) called "prova-de-vida-cordova-plugin". It must open a CameraPreview Activity for result, do it's stuff then send the result back. 

I started using a local Cordova project to test it, installed my local plugin in the application, and It worked like a charm. But when I pushed to a repository, added to an Outsystems plugin (using template plugin), built and application and the native app using the plugin, It just don't work!! 

It is not even available in the plugin folder of the browser, so in the console my plugin is not installed (undefined). I tried to analyze the generated .apk in Android Studio, but there is no sign of my plugin there...

Every time a run a build for native platform on Outsystems of my application I just cross my fingers and hope for the best, but is there an smart way of debugging that? Maybe a docker image for the building environment to test the build with the same configurations of the server.

My last build log from ServiceCenter tells it was added, but it was not installed on my application.

[2019-10-23T18:53:50.533Z] [INFO] Start processing job request...
[2019-10-23T18:53:50.536Z] [INFO] Start generating application...
[2019-10-23T18:53:50.536Z] [INFO] Template version: 5.1.12
[2019-10-23T18:53:50.536Z] [INFO] Build features: cordovaNoFetch - true
[2019-10-23T18:53:50.536Z] [INFO] Build features: buildTimeout - 20
[2019-10-23T18:53:50.537Z] [INFO] Creating a temporary folder for the application...
[2019-10-23T18:53:50.537Z] [INFO] Creating the required directory structure for your cordova application...
[2019-10-23T18:53:54.188Z] [INFO] Getting application resources...
[2019-10-23T18:53:54.208Z] [INFO] Processing application resources...
[2019-10-23T18:53:54.448Z] [INFO] Generating application assets...
[2019-10-23T18:53:54.845Z] [INFO] Applying configurations in the config.xml file...
[2019-10-23T18:53:54.850Z] [INFO] Applying advanced configurations in the config.xml file...
[2019-10-23T18:53:54.851Z] [INFO] Applying custom application icons...
[2019-10-23T18:53:54.851Z] [INFO] Applying custom application splashscreens...
[2019-10-23T18:53:54.851Z] [INFO] Applying application preferences...
[2019-10-23T18:53:54.851Z] [INFO] Applying application accessList...
[2019-10-23T18:53:54.851Z] [INFO] Adding target platform...
[2019-10-23T18:54:28.418Z] [INFO] Applying plugins in the config.xml file...
[2019-10-23T18:54:28.419Z] [INFO] Plugin Id: https://github.com/OutSystems/cordova-plugin-camera#4.0.3-OS2
[2019-10-23T18:54:28.419Z] [INFO] Plugin Action: add
[2019-10-23T18:54:31.268Z] [INFO] Plugin Id: https://github.com/OutSystems/cordova-plugin-geolocation.git#4.0.1-OS1
[2019-10-23T18:54:31.268Z] [INFO] Plugin Action: add
[2019-10-23T18:54:33.877Z] [INFO] Plugin Id: https://github.com/OutSystems/cordova-plugin-inappbrowser.git#3.0.0-OS1
[2019-10-23T18:54:33.877Z] [INFO] Plugin Action: add
[2019-10-23T18:54:36.645Z] [INFO] Plugin Id: 
https://gitlab.com/serpro-lowcode/prova-de-vida-cordova-plugin
[2019-10-23T18:54:36.645Z] [INFO] Plugin Action: add
[2019-10-23T18:54:39.252Z] [INFO] Plugin Id: https://github.com/OutSystems/csZBar.git#v1.3.3-OS8-MABS5
[2019-10-23T18:54:39.253Z] [INFO] Plugin Action: add
[2019-10-23T18:54:42.466Z] [INFO] Getting signing keys...
[2019-10-23T18:54:42.686Z] [INFO] Building application package...
[2019-10-23T18:55:53.961Z] [INFO] Checking application package...
[2019-10-23T18:55:53.961Z] [INFO] Remove debug/release signing properties
[2019-10-23T18:55:53.961Z] [INFO] Zipping application source code...
[2019-10-23T18:56:23.743Z] [INFO] Saving package and source files...
[2019-10-23T18:56:23.797Z] [INFO] Removing temporary folder...
[2019-10-23T18:56:25.172Z] [INFO] Application was successfully generated!
[2019-10-23T18:56:25.174Z] [INFO] Execution time: 154675ms

Solution

Hi Edgar,

I feel your strugles! So debugging native code from Outsystems/browser is not possible.
In order to build a plugin for outsystems, first we build the plugin, then a test app, then we use the test app to debug the native code. Once we are sure that the plugin does what it was planned, then it gets integrated into outsystems.

(native code)
If you are building plugin for Android, you can use any java IDE to build and debug.
if you are building for IOS, you need a MAC with Xcode to build/debug! no other solution works :(

Becouse the cordova plugins are basically native code wrapped in javascript, as soon it gets integrated in outsystems, you cant see native code. However you can see the javascript.

(javascript)
For IOS, you still need a mac, and set the safari to listen to your device, and then you can debug the javascript.
For Android is more easy, you can use any browser that allows device inspection ( i use Chrome,windows).

-There are small settings that need to be changed so that you can allow a computer to listen to a device.(check target device)

PS: when it comes to plugins, you need to test them in device, Outsystems Now doesnt work for custom plugins neither test in browser.

hope it was helpfull
Slavi

Solution

Hi Edgar,

Did you uninstall and install the app in your device?


Best regards,

Leandro. 

Slavi Popov wrote:

Hi Edgar,

I feel your strugles! So debugging native code from Outsystems/browser is not possible.
In order to build a plugin for outsystems, first we build the plugin, then a test app, then we use the test app to debug the native code. Once we are sure that the plugin does what it was planned, then it gets integrated into outsystems.

(native code)
If you are building plugin for Android, you can use any java IDE to build and debug.
if you are building for IOS, you need a MAC with Xcode to build/debug! no other solution works :(

Becouse the cordova plugins are basically native code wrapped in javascript, as soon it gets integrated in outsystems, you cant see native code. However you can see the javascript.

(javascript)
For IOS, you still need a mac, and set the safari to listen to your device, and then you can debug the javascript.
For Android is more easy, you can use any browser that allows device inspection ( i use Chrome,windows).

-There are small settings that need to be changed so that you can allow a computer to listen to a device.(check target device)

PS: when it comes to plugins, you need to test them in device, Outsystems Now doesnt work for custom plugins neither test in browser.

hope it was helpfull
Slavi


Thanks a lot, Slavi. I spent the last week figuring out this technique you have described. Even though my plugin runs on a cordova based project, real problem is building inside Outsystems environment, using MABS and everything else. To debug that I was logging information to the build log, I don't know the project structure and my plugin performs directory-dependent tasks :/ like modifying top level build.gradle for kotlin and google services support.