Android AOSP编译错误-在aidl文件中找不到导入 [英] Android AOSP compilation error - can't find import in aidl file

查看:470
本文介绍了Android AOSP编译错误-在aidl文件中找不到导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过添加新的系统服务来修改AOSP.

I am trying to modify AOSP by adding a new system service.

我对服务的帮助如下:

package android.app;

import java.util.ArrayList;

import android.app.TypeA;
import android.app.TypeB;

interface myService { 

     ArrayList<TypeA> getA();
     ArrayList<TypeB> getB();

}

TypeA和TypeB正在实现Parcelable接口,但是当我尝试构建Android时,它仍然无法导入以下3:

TypeA and TypeB are implementing Parcelable interface, still when I try to build Android, it fails to import these 3:

couldn't find import for class java.util.ArrayList
couldn't find import for class android.app.TypeA
couldn't find import for class android.app.TypeB

我已经查看了有关SO的其他相关问题,但到目前为止,还没有找到适合我的答案.

I have looked at other related questions on SO and so far have not found an answer that works for me.

有人知道如何解决这个问题吗?

Does anyone know how to resolve this ?

推荐答案

我可以看到一个问题,我会猜测一秒钟:

I can see one problem and I'll guess at a second:

  • ArrayList,TypeA和TypeB不可打包.您通过Binder传递的所有对象都必须实现Parcelable接口.
  • 为了使AIDL起作用,必须在AIDL文件中声明AIDL定义中使用的每个对象.例如,如果TypeA did 实现了Parcelable,您仍然需要一个AIDL文件
  • ArrayList, TypeA and TypeB are not Parcelable. All of the objects you pass around, via Binder, must implement the Parcelable interface.
  • In order for AIDL to work, you must declare every object used in an AIDL definition, in an AIDL file. If, for instance, TypeA did implement Parcelable, you still need an AIDL file for it

赞:

package my.app;

parcelable TypeA;

这篇关于Android AOSP编译错误-在aidl文件中找不到导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆