1Android for Cars App Library Samples 2=========================================== 3This directory contains sample apps that use Android for Cars App Library. 4Please find the library documentation at https://developer.android.com/training/cars/navigation. 5 6Build and Run From Android Studio 7----------------------- 8In order to build app APKs, 9 101. Open the [AndroidX project][5] in Android Studio. 11 122. Select a sample app directory (e.g. `showcase-mobile`) in the `Project Structure` UI on the top 13 left. Each sample app has two build targets, one for the mobile platform and the other for the 14 automotive platform. 15 163. Go to `Build -> Make Module 'androidx.car.app.app-samples.<sample_app>-<platform>'`. The apks 17 will be generated in `<repo root>/out/androidx/car/app/app-samples/<sample_app>-<platform>/build 18 /outputs/apk`. 19 20In order to install and run the apps, 21 221. Open the [AndroidX project][5] in Android Studio. 23 242. Go to `Run -> Edit Configurations`, select a sample app target (e.g. `car.app.app-samples 25.showcase-mobile`). If you are building for the `mobile` platform, also select `Launch: Nothing 26` in `General -> Launch Options`. Click `OK` to close the dialog. 27 283. Select `Run -> Run <sample_app>`, to run the app, which will just install it in the selected 29 device. 30 31Run From the Command Line 32--------------------- 33Run `./gradlew :car:app:app-samples:<sample_app>-<platform>:assemble` to assemble the APKs. E.g. 34 35```bash 36./gradlew :car:app:app-samples:showcase-mobile:assemble 37 ./gradlew :car:app:app-samples:showcase-automotive:assemble 38``` 39 40The APKs will be generated in `<repo root>/out/androidx/car/app/app-samples/<sample_app>-<platform>/build/outputs/apk`. 41 42Install the APK with ADB: 43 44```bash 45adb install <path_to_sample_app_apk> 46``` 47 48In order to install to a device directly, run the `installDebug` or `installRelease` gradle task 49. E.g. 50 51```bash 52./gradlew :car:app:app-samples:showcase-mobile:installDebug 53./gradlew :car:app:app-samples:showcase-automotive:installRelease 54``` 55 56Run the Mobile App in the Desktop Head Unit (DHU) 57------------------------------------------- 58Follow the instructions in [Test Android apps for cars][1] to run the sample apps in the DHU. 59 60In short: 61 621. [Enable the Android Developer Settings][2] 632. [Enable Unknown Sources in Android Auto][3] 643. [Run the DHU][4] 65 66**Note**: In Android Q, there is no Android Auto app in the launcher. The way to get to the settings in that case is through Settings -> Apps & Notifications -> See all apps -> Android Auto -> Advanced -> Additional settings in the app. 67 68Run the Automotive Apps in the Automotive OS Emulator 69------------------------------------------- 70In order to use the Automotive OS emulator, download the Android Studio 4.2 or higher (currently 71only available in the Beta and Canary tracks), and do the following: 72 731. Follow instructions to [run an Automotive OS emulator][6]. 742. Follow instructions to [update the Template Host app][7]. 75 76[1]: https://developer.android.com/training/cars/testing 77[2]: https://developer.android.com/studio/debug/dev-options 78[3]: https://developer.android.com/training/cars/testing#step1 79[4]: https://developer.android.com/training/cars/testing#running-dhu 80[5]: https://android.googlesource.com/platform/frameworks/support/+/ac0c1d466abcfdcab2babb2e10eca574247e3c92/README.md#using-android-studio 81[6]: https://developer.android.com/training/cars/testing#system-images 82[7]: https://developer.android.com/training/cars/apps/automotive-os 83