Hello, i have been facing this challange for while.

I have custom plugin developed in Java/JS for android, and  i am able to build it using Cordova and install it on Android phone, however when it comes to Outsystems, seems i am unable to build it.

If i tried to build it the way it came to me, the building log says : "Gps.java:41: error: strings in switch are not supported in -source 1.6"

I tried to change the code, so it doesnt use Strings in Switch, but then  
it returns
"Gps.java:42: error: local variable setupArgumentString is accessed from within inner class; needs to be declared final".

And i am wondering what else could i try...

Project:
https://gitlab.com/slavipopov/cordova-plugin-gps.git


Have you tried creating a simpler plugin to verify that you are able to build a Java plugin at all in OutSystems? Just wondering if perhaps there's a configuration issue.

Strip it down to the simplest possible plugin, and if you are able to get that working, slowly add back the needed functionality until you hit the issue again. That will at least help you narrow down where you're running into problems.

Hi Andrew,
Yes i kind of follow the guide https://www.outsystems.com/blog/posts/how-to-create-a-cordova-plugin-from-scratch/
i managed to replicate the Toasty Plugin, and sucessfully build and install.

I was trying to avoid deep dive into the code. Becouse I was able to install it on android phone, using Cordova Cli.
Therefore the code which implement the plugin is logically correct and valid.

But not for outsystems. I was hoping someone hit the same problem like me.

Solution


Hi Slavi Popov,

you can make it final or global so that the variable can be used in the inner class.

I reviewed your Gps.Java & here's the change you need to update.

Thus try declaring the setupArgumentString as Final or Make it Global.

Remember :

If you make it Final, You cannot change it later in Execution.

As of Your holder is an inner class. I will recommend You to declare it as a global variable, then initialize it when you require it


Hope it Helps!!

- Assif


Solution

Well thanks Assif,

Since my background is .NET/C#, it wasn´t very clear to me, but after your direction, i researched more about java OO. And yes make sense.

Thanks one more time,

Slavi Popov


Slavi Popov wrote:

Well thanks Assif,

Since my background is .NET/C#, it wasn´t very clear to me, but after your direction, i researched more about java OO. And yes make sense.

Thanks one more time,

Slavi Popov

Woo Happy to know you resolved it :)

Cheers,

Assif