HelloWorldAndroidNet sample application for Android
The HelloWorldAndroidNet sample application is a very simple Android/.NET application, consisting of an Android specific project that contains an Android/.NET MapControl.
Prerequisites
To build this sample you need a .NET SDK for Windows or Linux.
The sample includes a NuGet.config file that should set up the paths to find the required Carmenta Engine NuGet package automatically.
You also need a valid Carmenta Engine SDK or Carmenta Engine Evaluation license key.
Building and running the sample
Unpack the HelloWorldAndroidNet archive.
Open the solution file in Visual Studio 2022 or follow the instruction below to build using the .NET SDK on Windows or Linux.
Locate your Carmenta Engine license key file on your PC (C:\ProgramData\Carmenta\License.carmentakey or /etc/Carmenta/License.carmentakey). Include it in your project so that it is located under Assets/carmenta.engine/data relative to the .csproj file. This can be done by first putting the file in that folder, followed by enabling the Show all files button in the Solution Explorer and locating the file in the browser. Right click on the file and include it. It should automatically get the property Build Action AndroidAsset, which means it will be included in the assets of the generated APK.
Deploy and run the sample with a device attached.
To build the sample for Android without using Visual Studio, do the following:
Install Android Studio and the Android SDK.
Install the Android SDK platform for API level 31 in the Android SDK Manager (Tools > Open Android SDK Manager...).
In the HelloWorldAndroidNet sample directory, run:
dotnet workload restore
dotnet build -c Release -p:AndroidSdkDirectory=[Path to the Android SDK directory]
The Path to the Android SDK directory should be replaced with the directory where the Android SDK is installed, typically ${HOME}/Android/Sdk on Linux and %LOCALAPPDATA%\Android\Sdk on Windows.
The sample application will display a map window with a sample map configuration, with full pan and zoom functionality.
![]() |