Get started with Android for Cars

This topic shows you how to set up your development environment so that you can build a driver-optimized app for Android Automotive OS and extend your phone app to users who have the Android Auto app. For an overview of how Android enables app experiences on the road, see Android for Cars overview.

Set up your project

This section describes how to set up your app's project to support Android Automotive OS and Android Auto.

Enable automotive features in Android Studio

To access features for building and testing for Android Automotive OS, you must be using Android Studio 3.5 Canary 11 or higher.

Then, follow these steps to enable automotive features:

  1. If the file does not already exist, create a studioFlags.xml file in one of the following locations, depending on your operating system:

    • Windows: %USERPROFILE%\.AndroidStudioPreview3.5\config\options
    • macOS: ~/Library/Preferences/AndroidStudioPreview3.5/options
    • Linux: ~/.AndroidStudioPreview3.5/config/options
  2. Add the following entry to the studioFlags.xml file:

    <component name="StudioFlags">
      <option name="data">
          <entry key="npw.templates.automotive" value="true" />

Set your app's targetSdkVersion

To access the APIs that you need to support both Android Auto and Android Automotive OS, your must create or update your project to target the following API levels:

  • For Android Auto: Android 5.0 (API level 21) or higher
  • For Android Automotive OS: Android 9 (API level 28) or higher

To set these targets for your project, follow these steps:

  1. Set the targetSdkVersion attribute in uses-sdk element to 21 or higher in your phone app module's AndroidManifest.xml file.
  2. Set the targetSdkVersion attribute in uses-sdk element to 28 or higher in your Automotive OS app module's AndroidManifest.xml file.

    All cars that support Android Automotive OS run on Android 9 (API level 28) or higher, so selecting this value targets 100% of cars that use Android Automotive OS.

Add features to your app

After you have completed your initial project setup, you're ready to build for Automotive OS and Android Auto. See these topics to help you build your app: