Run the Sample Application
This tutorial contains instructions on how to run the basic sample application to render a map on an Android device. This tutorial assumes that you are using the Android Studio development environment and a supported Android device. For more details, see System Requirements.
- Open the sample project in Android Studio.
- Import the necessary resources into the project.
- Add HERE Credentials. For the full authentication story, see the Identity & Access Management Developer Guide.
Open the Sample Project in Android Studio
The next task before running the sample HERE SDK project is to locate the project folder and open it in Android Studio as follows:
- In the Welcome to Android Studio dialogue box select Open an existing Android Studio project.
- In the Open File or Project dialogue box select the
BasicMapSolution
folder from your file system and click OK. TheBasicMapSolution
folder is located atHERE-sdk.zip/HERE-sdk/tutorial/
. - After completing these steps the main Android Studio project window should appear with
"Error: Failed to resolve: :HERE-sdk:"
in the Messages pane.
Import the HERE SDK Android Archive
The SDK for Android library is shipped as an Android Archive (.AAR
) file. You can import this library by doing the following:
- On the View menu click .
- A few tabs are available in this tool window. Select the Project tab to show a file system view of the application structure.
- Set Project's view to
Project
instead ofAndroid
. - Right-click on the
app
folder and select to create a new folder. Uselibs
as the new folder name. - In your operating system's file system navigate to the extracted HERE SDK directory. Copy the
HERE-sdk.aar
file and paste it into the newly createdlibs
directory. - Open the
build.gradle
file under theapp
folder and ensure the following entry is present:dependencies { implementation files('libs/HERE-sdk.aar') // Depending on your specific project configuration you may have other entries here. }
- Optional: To enable quick Javadoc reference within your Android Studio environment, scroll down to the External Libraries section, right-click on
HERE-sdk
, and then select Library Properties. Click the + button and locateHERE-sdk-javadoc.jar
from HERE SDK package.
HERE-sdk.aar
by using the menu, selecting , and clicking the "+" button. If you use this method, ensure that HERE-sdk
is listed properly under the app
Module Dependencies. 
Add Credentials
This sample application is not shipped with a set of required HERE SDK credentials. Typically, before developing a new HERE SDK application, you need to acquire a set of credentials by registering your application on https://developer.here.com. Each application requires a unique set of credentials. When you register your app, the registered bundle identifier must match the applicationId in your project's build.gradle. For the full authentication story, see the Identity & Access Management Developer Guide.
Since this sample app has the package name com.here.android.tutorial
by default, you can generate a set of app credentials on https://developer.here.com using the same package name and add them to the app.
You can add credentials to your app by opening the BasicMapSolution/app/src/main/AndroidManifest.xml
file and modifying the following <meta-data>
tags:
<meta-data android:name="com.here.android.maps.appid" android:value="{YOUR_APP_ID}"/>
<meta-data android:name="com.here.android.maps.apptoken" android:value="{YOUR_APP_CODE}"/>
-
<meta-data android:name="com.here.android.maps.license.key" android:value="{YOUR_LICENSE_KEY}"/>"/>
Run the Project
You can run your simple application by pressing the key combination Shift + F10 (or Ctrl + R on macOS) from within Android Studio. The application renders a map retrieved from HERE servers. When you are running your application on a device, make sure data connection is enabled.