Matter TV Casting Android App Example

This is a Matter TV Casting Android app that can be used to cast content to a TV. This app discovers TVs on the local network that act as commissioners, lets the user select one, sends the TV a User Directed Commissioning request, enters commissioning mode, advertises itself as a Commissionable Node and gets commissioned. Then it allows the user to send Matter ContentLauncher commands to the TV.

Requirements for building

You need Android SDK 21 & NDK downloaded to your machine. Set the $ANDROID_HOME environment variable to where the SDK is downloaded and the $ANDROID_NDK_HOME environment variable to point to where the NDK package is downloaded.


TARGET_CPU can have the following values, depending on your smartphone CPU architecture:


Gradle & JDK Version

We are using Gradle 7.1.1 for all android project which does not support Java 17 ( while the default JDK version on MacOS for Apple Silicon is ‘openjdk 17.0.1’ or above.

Using JDK bundled with Android Studio will help with that.

export JAVA_HOME=/Applications/Android\

Preparing for build

Complete the following steps to prepare the Matter build:

  1. Check out the Matter repository.

  2. Run bootstrap (only required first time)

    source scripts/

Building & Installing the app

This is the simplest option. In the command line, run the following command from the top Matter directory:

./scripts/build/ --target android-arm64-tv-casting-app build

See the table above for other values of TARGET_CPU.

The debug Android package app-debug.apk will be generated at out/android-$TARGET_CPU-tv-casting-app/outputs/apk/debug/, and can be installed with

adb install out/android-$TARGET_CPU-tv-casting-app/outputs/apk/debug/app-debug.apk

You can use Android Studio to edit the Android app itself and run it after, but you will not be able to edit Matter Android code from src/controller/java, or other Matter C++ code within Android Studio.