質問

I am trying to write an AIDL file required for my service. It looks like below:

// --------------------------------------- ISomeIface.aidl

package com.vinay.mm.aidl;
import android.net.NetworkInfo;

interface ISomeIface
{
    int someFunction( int arg0, int arg1);
}

It is ok without import android.net.NetworkInfo; in aidl file. The error i am getting is couldn't find import for class android.net.NetworkInfo

So I copied the NewtorkInfo file in my project (had to fix some errors), as shown enter image description here

and then changed the import android.net.NetworkInfo; to import com.vinay.mm.net.NetworkInfo; as shown below.

package com.vinay.mm.aidl;
import com.vinay.mm.net.NetworkInfo;

interface ISomeIface
{
    int someFunction( int arg0, int arg1);
}

Now it works without any problem. Can you please suggest me What am I doing wrong? Thanks.

役に立ちましたか?

解決

All the files appearing in aidl imports should be same in package and should be parcelable in both ends, this is small point to note while dealing with aidl else you end up with error.

Thats why for first it didnt work, but when you moved it to same package it worked.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top