Porting from Android to Codename One. How much pain?

112 views
Skip to first unread message

Roger Keays

unread,
Feb 22, 2015, 4:28:42 AM2/22/15
to codenameone...@googlegroups.com
Hello all,

I am planning on porting some android applications to codename one and have been through the videos and tutorials on the website. Before I dive in I thought it might be worth checking in with the experts to see if you guys can give me an idea of where I should expect some pain.

Our current stack is

 - Maven
 - Lombok (for @Getter and @Setter annotations)
 - Retrolambda (so we can use Java 8 lambdas instead of inner classes for event handling)
 - JUnit
 - Robolectric
 - SQLite
 - OrmLite
 - Android-support (for ActionBar buttons)

My guess is OrmLite will have to go which will mean a lot of rework unless there is a port of OrmLite that works with CN1? Also, will I be able to use SQLite on Windows Phones, and if not, what is it the alternative?

Thanks in advance.

Roger

Shai Almog

unread,
Feb 22, 2015, 9:53:04 AM2/22/15
to codenameone...@googlegroups.com
Hi,
our build is based on Ant and not Maven. Maven is problematic since its designed to fetch external dependencies which in our case probably don't work. We need libs to be sanitized see: http://codenameone.com/cn1libs.html
I'm guessing Lombok uses either reflection or bytecode manipulation both of which won't work since if we strip everything from the VM during the C translation process and produce a very concise/efficient executable.
Retrolambda might work if you translate to Java 5, we didn't test that though. Its something we'd like to build into Codename One in the future but its not something we scheduled yet.
We have our own unit testing since JUnit needs reflection.
We support SQLite but you will need to use our API's and not the Android API's.
We don't support ORM (see above).
ActionBar support is builtin so you don't need that.

Roger Keays

unread,
Feb 23, 2015, 4:20:24 AM2/23/15
to codenameone...@googlegroups.com
I just stumbled across Steve's cn1-data-access-lib which could be a reasonable replacement for ORMLite:


This library isn't listed on the plugins page - does is still work?

Shai Almog

unread,
Feb 23, 2015, 12:16:54 PM2/23/15
to codenameone...@googlegroups.com
You mean the cn1lib page?
If its missing there then its an unintentional omission on our part.

Roger Keays

unread,
Feb 23, 2015, 3:28:28 PM2/23/15
to codenameone...@googlegroups.com

On Monday, 23 February, 2015 10:46 PM, Shai Almog wrote:
You mean the cn1lib page?
If its missing there then its an unintentional omission on our part.
Yes, it's not there

http://www.codenameone.com/cn1libs.html

--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/fPSXD2vnoIE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/d258ecaa-9cb9-4204-94f5-cc2fa241712e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steve Hannah

unread,
Feb 23, 2015, 4:42:22 PM2/23/15
to codenameone...@googlegroups.com
On Mon, Feb 23, 2015 at 1:20 AM, Roger Keays <rogerk...@gmail.com> wrote:
I just stumbled across Steve's cn1-data-access-lib which could be a reasonable replacement for ORMLite:


This library isn't listed on the plugins page - does is still work?

Yes. It still works.  However, it is a layer over top of the CN1 SQLite libraries so it currently only runs on platforms that support SQLlite.  Currently this includes Android, iOS, and the Simulator (JavaSE) only.  

Steve

maaar...@gmail.com

unread,
Oct 12, 2015, 10:54:54 PM10/12/15
to CodenameOne Discussions
On Sunday, February 22, 2015 at 3:53:04 PM UTC+1, Shai Almog wrote:

I'm guessing Lombok uses either reflection or bytecode manipulation both of which won't work since if we strip everything from the VM during the C translation process and produce a very concise/efficient executable.

No, Lombok is compile time only, it does AST transformations. It masquerades like APT, but instead of generating new files, it hacks into the Eclipse or javac internals. There's also a tool called delombok, which produces plain Java code, so there's always a way.

My question is if anybody has tried it already.... and if it works together with CD1 in Eclipse.

Shai Almog

unread,
Oct 13, 2015, 12:47:07 AM10/13/15
to CodenameOne Discussions, maaar...@gmail.com
I'm not aware of anyone who tried it. We use Ant for the compilation process but AFAIK the <javac> task in Ant maps to AST under Eclipse so it might work just fine out of the box.
I would recommend trying this with the Java 8 support for maximum compatibility and verifying with device builds before declaring success...
Reply all
Reply to author
Forward
0 new messages