Jake
Jake

Reputation: 16867

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

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 ?

Upvotes: 1

Views: 3437

Answers (1)

G. Blake Meike
G. Blake Meike

Reputation: 6705

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;

Upvotes: 3

Related Questions