Android AOSP compilation error - can't find import in aidl file

╄→尐↘猪︶ㄣ 提交于 2019-12-11 12:33:26

问题


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

I have the aidl for the service as follows :

package android.app;

import java.util.ArrayList;

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

interface myService { 

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

}

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

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 ?


回答1:


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

  • 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

Like this:

package my.app;

parcelable TypeA;


来源:https://stackoverflow.com/questions/24854980/android-aosp-compilation-error-cant-find-import-in-aidl-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!