NullPointerException when trying to run a HelloWorld program

Hello!

I am trying to build a simple hello world application but I get a NullPointerException when trying to build/run it:

java -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar /home/otavio/tools/garmin/bin/monkeybrains.jar -o /home/otavio/code/garmin/hello-world/out/test/hello-world/hello-world.prg -w -y /home/otavio/Sync/Tools/garmin/developer-key/developer_key.der -z /home/otavio/code/garmin/hello-world/resources/layouts/layout.xml:/home/otavio/code/garmin/hello-world/resources/drawables/drawables.xml:/home/otavio/code/garmin/hello-world/resources/strings/strings.xml -m /home/otavio/code/garmin/hello-world/manifest.xml /home/otavio/code/garmin/hello-world/source/Hello-worldView.mc /home/otavio/code/garmin/hello-world/source/Hello-worldApp.mc -d square_watch_sim -s 1.2.1 --unit-test
ERROR: null
java.lang.NullPointerException
at com.garmin.monkeybrains.devices.SimDevice.<init>(SimDevice.java:12)
at com.garmin.monkeybrains.Monkeybrains.run(Monkeybrains.java:2383)
at com.garmin.monkeybrains.Monkeybrains.simpleMain(Monkeybrains.java:270)
at com.garmin.monkeybrains.Monkeybrains.simpleMain(Monkeybrains.java:253)
at com.garmin.monkeybrains.Monkeybrains.main(Monkeybrains.java:299)
usage: monkeyc [-a <arg>] [-b] [-c <arg>] [-d <arg>] [-e] [-f <arg>] [-g] [-h
<arg>] [--hideApi <arg>] [-i <arg>] [-k] [-m <arg>] [-n <arg>] [-o <arg>]
[-p <arg>] [-r] [-s <arg>] [-t] [-u <arg>] [-v] [-w] [-x <arg>] [-y
<arg>] [-z <arg>]
-a,--apidb <arg> API import file
-b,--buildapi Build API output files
-c,--configs-dir <arg> Configuration directory for each device
-d,--device <arg> Target device
-e,--package-app Create an application package.
-f,--jungles <arg> Jungle files
-g,--debug Print debug output
-h,--excludes-map-file <arg>Mapping file of exclusions
--hideApi <arg> Hide API annotations
-i,--import-dbg <arg> Import api.debug.xml
-k,--write-db Write out the api.db file
-m,--manifest <arg> Manifest file
-n,--api-version <arg> The new API version
-o,--output <arg> Output file to create
-p,--project-info <arg> projectInfo.xml file to use when compiling
-r,--release Strip debug information
-s,--sdk-version <arg> SDK version to target
-t,--unit-test Enables compilation of unit tests
-u,--devices <arg> devices.xml file to use when compiling
-v,--version Prints the compiler version
-w,--warn Show compiler warnings
-x,--excludes <arg> Add annotations to the exclude list
-y,--private-key <arg> Private key to sign builds with
-z,--rez <arg> Resource file
FAIL: 100


I tried a few different things, like running monkeyc directly with the same paremeters, but I got the same result. The source code for the hello world program is available here.

This is what I have installed:

$ monkeyc --version [16:32:12]
Connect IQ compiler version 2.4.1



Unfortunately, the error information is not available and I cannot figure out what is going on. I am completely new to this SDK. Anyone has any idea what could be wrong?


  • First of all "square_watch" went away long ago. (it's no longer a valid target) What version of the SDK are you using? You need to have a valid target. It you're just starting about, I would recommend starting with eclipse, as there are things you can only do using it, like the app settings editor.

    And for some initial projects, you likely want to start with the samples in the SDK directory. In this case, it looks like you got the source for an earlier version of the SDK (when it still had square_watch :) )