Reputation: 447
I want to create a service in its own process in order to communicate to different applications.
I'm following this guide http://www.donnfelker.com/rxjava-with-aidl-services/ but I'm having issue with the .aidl file.
This is my aidl interface:
// MyAidlInteface.aidl
package my.package;
import rx.Observable;
interface MyAidlInterface {
Observable<Integer> getPid();
}
Android Studio gives me the following error and I don't know what to do:
couldn't find import for class rx.Observable
Upvotes: 3
Views: 3238
Reputation: 6715
There are two problems here:
rx.Observable
. This is the source of the
AndroidStudio error. AIDL is not Java. Just because
rx.Observable
is visible to the Java compiler does not mean it is
visible to the AIDL compiler. For your own sanity, it makes a lot
of sense to put all of your AIDL into a separate top level source
folder. If it is not mixed up with your Java, then errors like this
are much easier to spot.rx.Observable
would have to say
something like:package rx; parcelable Observer;
Obviously, that won't work. rx.Observer
is not Parcelable. In order to do what you are trying to do you will have to create a Parcelable object with an AIDL definition, that is a proxy to the Observer
.
Upvotes: 3