Problems running newly generated projects in simulator (CN1)

23 views
Skip to first unread message

boreal...@gmail.com

unread,
Nov 21, 2017, 6:57:52 PM11/21/17
to CodenameOne Discussions
Hi,
I wanted to begin a new codename one app, but encountered problems with some of the options I tried.

I'm using: 
Windows 10
Eclipse 4.7.0
CodeNameoneFeature 3.7.3
Simulator

I tried creating a new barebones hello world project (using the flat blue theme).  It compiles, but when I run in the simulator, it throws an exception, when the theme.res file is first loaded in the init().

java.io.IOException: Error while trying to read theme property:
 at com.codename1.ui.util.Resources.loadTheme(Resources.java:1475)
 at com.codename1.ui.util.Resources.openFileImpl(Resources.java:303)
 at com.codename1.ui.util.Resources.openFile(Resources.java:269)
 at com.codename1.ui.util.Resources.<init>(Resources.java:189)
 at com.codename1.ui.util.Resources.open(Resources.java:740)
 at com.codename1.ui.util.Resources.openLayered(Resources.java:702)
 at com.codename1.ui.util.Resources.openLayered(Resources.java:666)
 at com.codename1.ui.plaf.UIManager.initFirstTheme(UIManager.java:1564)

In the debugger, the key in the loadTheme() method is an empty string. (local variable iter had a value of 4 when the exception was thrown).
The simulator runs, but the theme isn't applied.

I have an older app that also uses the flat blue theme, and it still runs fine.  I even tried replacing the "new" theme.res with the one from that older app, but the exception was the same, (in the new barebones hello world app).

As an experiment I tried generating a different project, "Get Started App" template with the business theme, i.e. the defaults.
It gave the same error as above.  
Also, it failed to load the apple-icon.png from the resource (resulting in a null pointer exception, and  termination). This was despite the fact that the image in question definitely is where it should be in the theme, as determined by running the theme editor!
The relevant code in the start() method:
Form hi = new Form("Welcome", new BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE));
final Label apple = new Label(theme.getImage("apple-icon.png"));

Finally I tried running one of the Demo projects, the Clean Material demo.  No errors. Runs fine. 

Honestly I'm not sure whether I am skipping some important, initial step that I have forgotten (having been working on the same old app for a year).

Primarily I just wanted a "known  good" app to send as my first iOS build.  The clean material demo will do fine for this purpose.
But if there is some glitch in the way eclipse handles newly generated project templates  (and not me making careless mistakes!) I thought it would be worth fixing for the sake of people coming to CN1 as new users.

Thanks,
Peter

boreal...@gmail.com

unread,
Nov 21, 2017, 7:49:28 PM11/21/17
to CodenameOne Discussions
Edit: It's the CleanModern demo that worked in the simulator, not clean material (no  such demo).  
When I installed CleanModern on an android device, it works until I hit the "skip" button, then there is an error dialog:

Shai Almog

unread,
Nov 22, 2017, 12:27:20 AM11/22/17
to CodenameOne Discussions
Hi,
You are compiling against older versions of the libs. You need to open Codename One Settings -> Basic -> Update Client Libs.
Make sure your plugin is the latest version (3.8).

boreal...@gmail.com

unread,
Nov 22, 2017, 9:39:04 AM11/22/17
to CodenameOne Discussions
Thanks!  That fixed it!
Reply all
Reply to author
Forward
0 new messages