Problem with monkeyc -e.

When I run the command

"monkeyc -f monkey2.jungle -e -o deluxe.iq -y key"

to make a publishable executable, I get the error "ERROR: null".

A couple of months ago it still worked (I only made a minor change in the source code).

When I, on the contrary, make an executable for the simulator with

"monkeyc -f monkey2.jungle -o deluxe.prg -y key"

it still works (with the same source code), and I can run "deluxe.prg" without problems in the simulator.

Anyone has an idea what goes wrong?

(I'm on an iMac)

  • I reply myself:

    I created a new project in Visual Studio Code (VSC) and copied everything of my original project hereto.

    In VSC now I manage to create an .iq file (with "Export Project").

    So I basically found a solution: if I want to publish I use VSC.

    In the directory of the newly created project the command

    "monkeyc -f monkey2.jungle -o deluxe.prg -y key"

    works again: and I can run the result in the simulator. So I do not need to use VSC while developing: only when I publish I need it.

    Still do not understand why "monkeyc" used to work to make a .iq file, and now at once not anymore...

  • Are you using the same SDK as before and pointed to the monkey C for the current SDK?

  • I THINK I used the same SDK as before.

    Anyway, my current SDK was 4.2.1.

    I changed that just now to 4.2.4, which results also in my PATH variable to point to 

    /Users/arjen/Library/Application Support/Garmin/ConnectIQ/Sdks/connectiq-sdk-mac-4.2.4-2023-04-05-5830cc591//bin

    so that should be ok.

    But still: when I run

    "monkeyc -f monkey2.jungle -e -o deluxe.iq -y key"

    it comes with 

    ERROR: null

    usage: monkeyc [-a <arg>] [-b <arg>] [--build-stats <arg>] [-c <arg>] [-d <arg>]

           [--debug-log-level <arg>] [--debug-log-output <arg>] [-e]

           [--Eno-invalid-symbol] [-f <arg>] [-g] [-h] [-i <arg>] [-k] [-l <arg>]

           [-m <arg>] [--no-gen-styles] [-o <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,--apimir <arg>          API MIR file

       --build-stats <arg>     Print build stats [0=basic]

    -c,--api-level <arg>       API Level to target

    -d,--device <arg>          Target device

       --debug-log-level <arg> Debug logging verbosity [0=errors, 1=basic,

                               2=intermediate, 3=verbose]

       --debug-log-output <arg>Output log zip file

    -e,--package-app           Create an application package.

       --Eno-invalid-symbol    Do not error when a symbol is found to be invalid

    -f,--jungles <arg>         Jungle files

    -g,--debug                 Print debug output

    -h,--help                  Prints help information

    -i,--import-dbg <arg>      Import api.debug.xml

    -k,--profile               Enable profiling support

    -l,--typecheck <arg>       Type check [0=off, 1=gradual, 2=informative,

                               3=strict]

    -m,--manifest <arg>        Manifest file (deprecated)

       --no-gen-styles         Do not generate Rez.Styles module

    -o,--output <arg>          Output file to create

    -O,--optimization <arg>    Optimization level [0=none, 1=basic, 2=fast

                               optimizations, 3=slow optimizations] [p=optimize

                               performance, z=optimize code space]

    -p,--project-info <arg>    projectInfo.xml file to use when compiling

    -r,--release               Strip debug information

    -s,--sdk-version <arg>     SDK version to target (deprecated, use -c

    -t,--unit-test             Enables compilation of unit tests

    -u,--devices <arg>         devices.xml file to use when compiling (deprecated)

    -v,--version               Prints the compiler version

    -w,--warn                  Show compiler warnings

    -x,--excludes <arg>        Add annotations to the exclude list (deprecated)

    -y,--private-key <arg>     Private key to sign builds with

    -z,--rez <arg>             Resource files (deprecated)

    The compiler runs though as long as necessary to make the .iq file, it seems it comes with the error at the end of compilation.

  • Did you add devices to your manifest but don't have those devices downloaded?

  • Even if I comment out all of the devices but the epix (which is certainly downloaded) the error comes.

    Mind that in VSC it works. Maybe I´ll try to get the output messages of monkeyc, which at the moment I only get if I compile via VSC: with monkeyc I do not get any massages in the terminal but the one at the end.

    On the other hand, I found a work-around with VSC so the problem is not really urgent anymore.

  • I was able to reproduce your problem (I think - the error message is slightly different, but that could be because you're probably using a different JDK).

    ~"/Library/Application Support/Garmin/ConnectIQ/Sdks/connectiq-sdk-mac-4.2.4-2023-04-05-5830cc591/bin/monkeyc" -e -o test.iq -f monkey.jungle -y PATH_TO_KEY

    ERROR: Cannot invoke "java.io.File.exists()" because "outputParentFile" is null

    Seems that the problem goes away if I change "test.iq" to "./test.iq"

    ~"/Library/Application Support/Garmin/ConnectIQ/Sdks/connectiq-sdk-mac-4.2.4-2023-04-05-5830cc591/bin/monkeyc" -e -o ./test.iq -f monkey.jungle -y PATH_TO_KEY

    I feel like this is a bug in the compiler but whatever ¯\_(ツ)_/¯

  • Yes that's the solution. Would have never found out myself.

    Thanks FlowState and also jim_m_58 for adopting may problem.

  • I have the exact same error

  • The problem seems to be that when you export a project, monkeyc expects the output argument (-o) to refer to a pathname (with a folder component) and not a "bare" filename with no folder.

    OPs problem is they specified "-o deluxe.iq" which is just a bare filename. The fix was to change "deluxe.iq" to "./deluxe.iq". It should also work if the output file is in some other folder.

    e.g. I would expect the following to also work (assuming the referenced folders exist):

    -o ../export/deluxe.iq
    -o /SOME/ABSOLUTE/PATH/ciq/export/deluxe.iq
    etc.

    The reason I think this is a compiler bug is because in almost every other case, when a command line tool asks for a pathname, a bare filename should work just as well.