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:
If the file does not already exist, create a
studioFlags.xmlfile in one of the following locations, depending on your operating system:
Add the following entry to the
<application> <component name="StudioFlags"> <option name="data"> <map> <entry key="npw.templates.automotive" value="true" /> </map> </option> </component> </application>
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:
- Set the
uses-sdkelement to 21 or higher in your phone app module's
uses-sdkelement to 28 or higher in your Automotive OS app module's
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: