Unable to access to android.car package.
After adding useLibrary 'android.car'
to build.gradle of app module it started building and running on emulator, but Android Studio still unable to access and/or show them.
import android.car.Car
import android.car.VehiclePropertyIds
import android.car.hardware.CarPropertyValue
import android.car.hardware.property.CarPropertyManager
Android Studio versions:
- Chipmunk 2021.2.1 | Patch 1
- Electric Eel | 2022.1.1 Canary 2
Android SDK: 29, 30, 31, 32
How can I fix it. Or somehow add android.car.jars. Because it is impossible to normally develop without highlighting and importing packages.
3
Answers
Not a real answer to the question (can’t comment yet):
in our project we have a similar problem. Chipmunk does not detect and/or resolve our project’s custom SDK add-on. It worked with BumbleBee.
We added dependencies to include the JAR files of the custom add-on, like this:
In this regard Chipmunk is broken IMHO.
We also use Android-car and use this:
We do not copy the JAR, just reference it directly.
The issue is still there in Google Issue Tracker
OPTION 1:
1- Copy
sdkDir/platforms/android-XX/optional/android.car.jar
toyourProjectDir/app/libs/android.car.jar
I tested with
android-32
2- Add it to the dependencies section in your
build.gradle
OPTION 2:
Based on @werner’s answer for groovy
build.gradle
Tested on:
Android Studio Chipmunk | 2021.2.1 Patch 1
Android Studio Electric Eel | 2022.1.1 Canary 8
In my project I have a similar problem, when I have upgraded target sdk version from 32 to 33. It occurs when pro-guard is enabled. I have tried many solutions. But the solution which worked for me is,
To move android.car.jar package path from
/Users/$username/Library/Android/sdk/platforms/android-33/optional
to/Users/$username/Library/Android/sdk/platforms/android-33
.Hope it will helps you too.