Jan 13, 2025by Benjamin Gallois

Garmin App Development Without the Visual Studio Code MonkeyC extension

Introduction

Understanding how things work under the hood is quite empowering for a developer. While tools like Visual Studio and various extensions offer a polished, easy-to-use experience, sometimes doing things manually is more insightful. This process can significantly boost your understanding of how an application is built, compiled, and run, especially for platforms like Garmin’s Connect IQ SDK.

Garmin provides a robust SDK for developing apps for its fitness and outdoor devices. However, the process can be more challenging and less documented without the Visual Studio extension. That being said, developing, building, testing, and releasing your apps manually without being trapped by an IDE is still completely feasible.

In this post, we’ll walk through some critical tricks that are poorly documented or entirely left out in Garmin’s official guides. These include:

Manually generating a key in the correct format: Creating a valid developer key for signing apps can be tricky, and the documentation does not always clearly state the necessary steps to generate it manually (in the correct format). Getting the persistent app configuration to work in the simulator: Setting up and testing app configurations is another area where documentation often falls short. We’ll cover how to ensure your app’s settings are accessible and functional during testing. Releasing an app manually without the compiler crashing for no apparent reason: Compiling and releasing an app can sometimes trigger inexplicable compiler crashes. We’ll review how to avoid or resolve these issues, ensuring a smoother process without relying on the Visual Studio extension.

This guide covers these essential but often overlooked aspects, empowering you to develop, test, and release your Garmin apps without being limited by incomplete or confusing documentation.

Note that if you encounter the Failed to create GBM buffer of size 400x586: Invalid argument error with the simulator or the installer, you can use:

WEBKIT_DISABLE_DMABUF_RENDERER=1 ./simulator
    

Why Manual Development?

Some developers dislike working within integrated development environments (IDEs) because they feel restricted by the abstraction of automated tasks. Compiling and testing an app manually gives you more granular control over the process, which can be a great learning experience.

With the Garmin SDK, it’s possible to develop an app manually without the Visual Studio extension. However, it can be tricky since Garmin’s documentation assumes the use of the extension and doesn’t explicitly cover the necessary manual steps for publishing an app. This post aims to fill that gap by walking through the steps of manual app development, including:

Step 1: Install the Garmin SDK

The first step is to install the Garmin Connect IQ SDK. This SDK contains the essential tools for app development, such as the MonkeyC compiler and the Simulator. The installation process is straightforward and well-documented in Garmin’s instructions, so we won’t go into detail here. Just make sure to download and install the SDK from Garmin’s website.

Once the SDK is installed, you’ll have access to the required tools, located at:

~/.Garmin/ConnectIQ/Sdks/connectiq-sdk-lin-7.4.3–2024–12–11–90ec25e45/bin
    

Step 2: Generate a Developer Key

Before you can start compiling and running your apps, you’ll need a developer key to sign your applications. This is where OpenSSL comes in handy. The process is done in two steps:

Step 3: Compile the App

The MonkeyC compiler is the core tool for compiling your app. The Garmin SDK provides app templates to help you get started. To compile an app for testing manually, use the following command:

~/.Garmin/ConnectIQ/Sdks/connectiq-sdk-lin-7.4.3–2024–12–11–90ec25e45/bin/monkeyc -d venu2 -f monkey.jungle -o myapp.prg -y private_key.der -w — debug-log-level=3
    

Let’s break down what this command does:

Step 4: Run the App in the Simulator

Once your app is compiled, you can test it using the Garmin Simulator. To do this:

The app will then load in the simulator, and you can edit and test your app’s persistent configuration. This is a crucial step for debugging and ensuring everything works as expected before releasing the app.

Step 5: Build the App for Release

After testing your app in the simulator and confirming it works as expected, it’s time to prepare it for release. To build the final app binary for publication, use the following command:

~/.Garmin/ConnectIQ/Sdks/connectiq-sdk-lin-7.4.3–2024–12–11–90ec25e45/bin/monkeyc -f monkey.jungle -o ./bin/myapp.iq -y private_key.der -e -r -w -O=3z
    

This will generate the final .iq file in the ./bin/ directory, the app package you’ll upload to the Garmin Connect IQ store. Note that the command will only succeed if the output path contains at least a folder.

Step 6: Automating the Process with a Makefile

To simplify the process and avoid typing the same commands repeatedly, you can create a Makefile to automate building, testing, and releasing the app. Here’s an example:

PRODUCT ?= default_product

build:
  ~/.Garmin/ConnectIQ/Sdks/connectiq-sdk-lin-7.4.3–2024–12–11–90ec25e45/bin/monkeyc -d $(PRODUCT) -f monkey.jungle -o myapp.prg -y private_key.der -w — debug-log-level=3
  ~/.Garmin/ConnectIQ/Sdks/connectiq-sdk-lin-7.4.3–2024–12–11–90ec25e45/bin/monkeydo myapp.prg $(PRODUCT) -a “myapp-settings.json:GARMIN/Settings/myapp-settings.json”

publish:
  rm -rf bin/
  mkdir bin/
  ~/.Garmin/ConnectIQ/Sdks/connectiq-sdk-lin-7.4.3–2024–12–11–90ec25e45/bin/monkeyc -f monkey.jungle -o ./bin/ myapp.iq -y private_key.der -e -r -w -O=3z

release: clean publish

clean:
  rm -rf gen/*
  rm -f myapp.prg
  rm -f myapp.prg.debug.xml
    

With this Makefile, you can automate the entire process using commands like:

Step 7: Publishing the App

Once you’ve tested and built your app, you can publish it to the Garmin Connect IQ store. This step will involve submitting the .iq file you generated earlier.

Final Thoughts

While using an IDE like Visual Studio with the Garmin extension can simplify the development process, manually building and testing your app helps you avoid being trapped in an IDE and gives you a deeper understanding of how the Garmin SDK and app lifecycle work. Following the steps outlined in this post, you can confidently develop and release apps for Garmin devices without relying on the Visual Studio extension.

This approach also offers more flexibility and control, especially when working with custom tools and configurations that the IDE may not fully support. Happy coding!