【问题标题】:android.car package is unavailable in Android Studioandroid.car 包在 Android Studio 中不可用
【发布时间】:2022-07-06 19:43:55
【问题描述】:

无法访问 android.car 包。

useLibrary 'android.car' 添加到 app 模块的 build.gradle 后,它开始在模拟器上构建和运行,但 Android Studio 仍然无法访问和/或显示它们。

import android.car.Car
import android.car.VehiclePropertyIds
import android.car.hardware.CarPropertyValue
import android.car.hardware.property.CarPropertyManager

Android Studio 版本:

  1. 花栗鼠 2021.2.1 |补丁 1
  2. 电鳗 | 2022.1.1 金丝雀 2

Android SDK:29、30、31、32

我该如何解决。或者以某种方式添加 android.car.jars。因为不高亮和导入包是无法正常开发的。

【问题讨论】:

  • 现在,我只是将 sdk/platforms/android-32/optional/android.car.jar 添加到项目的 app/libs 文件夹中。 32 是我的 compileSdkVersion 和 targetSdkVersion 版本。现在似乎正确显示了。但我真的不喜欢那个解决方案。

标签: android android-studio android-automotive


【解决方案1】:

这个问题没有真正的答案(还不能评论):

在我们的项目中,我们遇到了类似的问题。 Chipmunk 不会检测和/或解析我们项目的自定义 SDK 插件。它适用于 BumbleBee。

我们添加了依赖项以包含自定义插件的 JAR 文件,如下所示:

// See comment in the dependencies section below
val sdkDir: String = project.android.sdkDirectory.canonicalPath
val addOnPath = "$sdkDir/add-ons/addon-project-add-on/libs"

...
    // FIXME: Currently AS Chipmunk seems to have an issue to resolve custom SDK add-on
    //        jars. Gradle works and builds, only the IDE part seems to have a problem.
    //        The next line explicitly adds the custom SDK add-on JAR files as dependencies
    //        and AS Chipmunk's IDE part can now resolve classes etc.
    //        This is a workaround and maybe even a dirty trick and should be removed once
    //        AS was fixed. Need to check if this also works with CI (zuul)
    implementation(fileTree(mapOf("dir" to addOnPath, "include" to listOf("*.jar"))))

在这方面花栗鼠被打破恕我直言。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-02
    • 1970-01-01
    • 1970-01-01
    • 2018-08-09
    • 2014-03-20
    • 1970-01-01
    • 1970-01-01
    • 2017-01-31
    相关资源
    最近更新 更多