【问题标题】:android.location.Address not recognized by AIDL?AIDL 无法识别 android.location.Address?
【发布时间】:2013-04-29 19:40:23
【问题描述】:

我正在尝试从远程服务传回 List<Address> 对象,但我似乎无法弄清楚为什么会发生这种情况,但是当我尝试将 import android.location.Address 传入我的 Android AIDL 文件时,我的IDE (Eclipse) 将导入高亮显示为错误。这很奇怪,因为 Address 实现了 Parcelable 接口(android.location.Location 也是如此,它不会因为错误而被高亮显示)所以我希望这样做不会有任何问题。有什么想法吗?

我正在开发的 Android 平台是 4.2.2 Jelly Bean。

【问题讨论】:

    标签: android service gps location aidl


    【解决方案1】:

    虽然android.location.Address实现了Parcelable接口,但在sdk/platforms/android-<api-level>/framework.aidl中似乎没有声明为parcelable。作为一种解决方法,您可以添加以下行:

    parcelable android.location.Address;
    

    framework.aidl 文件以获取相应的 API 级别(在 4.2.2 JellyBean 的情况下为 17)。

    我更喜欢直接修改framework.aidl 文件的另一种方法是在src/android/location/Address.aidl 的项目中添加一个包含parcelable 声明的AIDL 接口文件,其中包含:

    package android.location;
    parcelable Address;
    

    我不知道为什么android.location.Address首先在framework.aidl中没有声明为parcelable

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-11
      • 1970-01-01
      • 2021-08-17
      • 1970-01-01
      • 2018-06-18
      • 2013-04-19
      • 2019-01-28
      相关资源
      最近更新 更多