Creating and using a developer key (not working)

Starting a blank project 

monkeyc create-project -t watchface -o MyWatchFace 

running, oops : 

ERROR: The private key was not specified. Use command line option: -y.

ok, system needs a private key, lets generate one and put it to accessible location like C:\Users\Public\Downloads

running again:

monkeyc create-project -t watchface -o MyWatchFace -y C:\Users\Public\Downloads

ERROR: Unable to load private key: C:\Users\Public\Downloads (Access is denied)

Now, I am running win 11 in administrator mode, VS code is running in administrator mode, I have tried numerous other locations starting from Root and im running out of ideas why I keep having access issues and deepseek, ChatGPT and Claude.ai are running in loops without any help. Might be that proper coding can only be done in Linux? Smile

is it also true, that working with Visual code studio requires all administrator privileges? As running it from regular user account, it cannot detect monkeyc (but can Java), however the path in env. settings is clearly defined. Quite frustrated already, that setting up the system is much more complicated than actual work on an app or watchface :( Slight smile

  • In the VSC Command Palette, use "Monkey C: Generate a Developer Key" and then in the Settings for the Monkey C Extension, you may have to add the path to the key file.

    You want to save a copy of the key file in a safe place as there is no way to recover it, and without it, you can't update your apps in the store.

    Instead of just the folder, you need to include the file the key is in. like this

    -y C:\Users\James\abc\ciq.key

  • Like jim_m_58 said, the path to the developer key (the argument to -y) is supposed to include the complete path to the key file, including the folder and filename. In the command line you posted, you have only specified the folder (C:\Users\Public\Downloads).

    Speaking of your command line:

    monkeyc create-project -t watchface -o MyWatchFace -y C:\Users\Public\Downloads

    - monkeyc is the compiler executable

    - "create-project" is not a valid compiler option

    - "-t watchface" is not a valid compiler option either

    Even if you adjust your command line to include the complete path to the developer key (as the argument to -y), it's still not going to work.

    Where exactly did you get this command line? From one of the LLMs you mentioned? Sorry bro, they lied to you.

    Unfortunately that's not a valid command line, and there's no way to create a new project from the command line, as far as I know.

    Here are the actual command line options for monkeyc: https://developer.garmin.com/connect-iq/monkey-c/compiler-options/

    I am running win 11 in administrator mode

    What does this mean? Does it mean you are logged on as an admin user? That's kind of irrelevant, because even admin users will launch apps/processes without admin privileges, by default. The only thing being an admin user buys you is the ability to elevate an app/process to have admin privileges, without typing in the password of another admin user. But you shouldn't have to run VS Code in admin mode at all (see below)

    VS code is running in administrator mode

    This is relevant, but you shouldn't have to do it.

    is it also true, that working with Visual code studio requires all administrator privileges?

    No.

    As running it from regular user account, it cannot detect monkeyc

    I assume you mean that when you type "monkeyc" in the VS Code terminal, the command isn't found.

    however the path in env. settings is clearly defined

    Are you sure? Open VS Code without admin privileges. In the VS Code terminal, type the appropriate command for your shell:

    (powershell)

    $env:path

    (cmd)

    echo %PATH%

    Do you see the path to the SDK bin folder in there, as per https://developer.garmin.com/connect-iq/reference-guides/monkey-c-command-line-setup/?

    If not, that would indicate that the path is not set properly for your non-admin user. Note that the instructions on that page for setting the PATH in Windows need to be repeated every time you open a new terminal (including the VS Code terminal).

    I don't have anything against doing stuff from the command line (I love the cmd line and scripting tbh), but I think it will be a lot easier for you if you use the VS Code Monkey C extension for most or all of your CIQ development, instead of the command line.

    For example, if you had generated the developer key using the Monkey C extension in the first place, it would've also automatically configured the key path in the extension settings, and every time you build using the extension, the key path would be automatically added to the command line.

    1) Ensure the VS Code Monkey C extension is installed, as per https://developer.garmin.com/connect-iq/sdk/. I think you've already done this

    2) Do one of the following:

    2a) generate a new developer key by opening the command palette (CTRL-SHIFT-P) and selecting "Monkey C: Generate a Developer Key". This will also automatically set the key path in the Monkey C extension options.

    or

    2b) Open CTRL-SHIFT-P > User Settings > Monkey C. Set the Developer Key Path option to the path of your existing developer key. i.e. C:\Users\Public\Downloads\KEY_FILENAME

    3) CTRL-SHIFT-P > Verify Installation

    Once you've verified your installation, you can use the Monkey C extension via the command palette for common tasks such as:

    - Create a new project: CTRL-SHIFT-P > Monkey C: New Project

    - Build current project (for running in the sim): CTRL-SHIFT-P > Monkey C: Build Current Project > (select device)

    - Run the last build in the sim: F5 (this will also rebuild the project if necessary, for the last selected device)

    - Build project for a sideload: CTRL-SHIFT-P > Monkey C: Build For Device

    - Export project to upload to the store: CTRL-SHIFT-P > Monkey C: Export Project

    Additional tasks:

    - Edit project properties: click on manifest.xml in left-hand Explorer panel. The manifest file may be displayed as an XML text file. You can open the manifest in a more friendly UI with CTRL-SHIFT-P > View: Reopen Editor With... > Manifest Editor (Monkey C)

  • Note that the instructions on that page for setting the PATH in Windows need to be repeated every time you open a new terminal (including the VS Code terminal).

    Ofc you should be able to set the PATH in a more persistent manner, but that's not documented, probably because there isn't a good way to automatically get the path of the current SDK at log-in / boot time in Windows, so any persistent changes to the PATH would be hardcoded to point at a specific SDK.