问题
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