Я создаю AIDL следующим образом:
Я установил эти 2 файла в каталоге AIDL:
IMDpcService.aidl:
// IMDpcService.aidl
package amiin.bazouk.application.com.doproject;
import amiin.bazouk.application.com.doproject.MBytes;
interface IMDpcService {
void setResetPassword(MBytes bytes);
}
MBytes.aidl:
package amiin.bazouk.application.com.doproject;
parcelable MBytes;
Я устанавливаю эти классы java в каталоге java:
MDpcService.java:
package amiin.bazouk.application.com.doproject;
import android.app.Service;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.util.Log;
public class MDpcService extends Service {
private final static String TAG = "Test-Tag";
private Binder mBinder;
@Override
public void onCreate() {
super.onCreate();
mBinder = new MsiDpcServiceImpl(this);
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return mBinder;
}
static class MDpcServiceImpl extends IMsiDpcService.Stub {
private Context mContext;
private DevicePolicyManager mDpm;
private ComponentName cpntName;
public MDpcServiceImpl(Context context) {
mContext = context;
mDpm = (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
cpntName = new ComponentName(context, DeviceOwnerReceiver.class);
}
@Override
public setResetPassword(MBytes bytes){
//do sth
}
}
}
MBytes.java
package amiin.bazouk.application.com.doproject;
import android.os.Parcel;
import android.os.Parcelable;
public class MBytes implements Parcelable {
private byte[] _byte;
public MBytes() {
}
public MBytes(Parcel in) {
readFromParcel(in);
}
public byte[] get_byte() {
return _byte;
}
public void set_byte(byte[] _byte) {
this._byte = _byte;
}
public int describeContents() {
return 0;
}
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(_byte.length);
dest.writeByteArray(_byte);
}
public void readFromParcel(Parcel in) {
_byte = new byte[in.readInt()];
in.readByteArray(_byte);
}
public static final Creator CREATOR = new Creator() {
public MBytes createFromParcel(Parcel in) {
return new MBytes(in);
}
public MBytes[] newArray(int size) {
return new MBytes[size];
}
};
}
Тем не менее, я получаю эту ошибку при компиляции:
Обрабатывать 'команду' C: \ Users \ Adrien \ AppData \ Local \ Android \ Sdk \ build-tools \ 27.0.3 \ aidl.exe'' закончено с ненулевым значением выхода 1
Что мне не хватает?