Search code examples
androidandroid-auto

How to utilize Android Car API inside an app


I want to test and (if possible) utilize Android Car API functionalities inside my Android app. Specifically, I need to be able to import classes under android.car.* package which can be seen here: https://developer.android.com/reference/android/car/packages.html

I also found the repo on Google Git: https://android.googlesource.com/platform/packages/services/Car/

How should I add this library as a dependency in my app?


Solution

  • The library is now released as part of Android Q SDK in Android Studio. You need to

    1. update the SDK 29 to minor version 5 using SDK manager

    2. Update app module build.gradle include car-lib

      android {
           compileSdkVersion 29
           buildToolsVersion "29.0.3"
           ...
           useLibrary 'android.car'
      }
      
    3. API documentation is available here