public void onServiceConnected(ComponentName name, IBinder service) {
//绑定成功回调
Log.d(TAG, "onServiceConnected");
mIMyAidlInterface = IMyAidlInterface.Stub.asInterface(service);
//获取服务端提供的接口
try {
// 注册死亡代理
if(mIMyAidlInterface != null){
Log.d(TAG, mIMyAidlInterface.getName());
service.linkToDeath(mDeathRecipient, 0);
} catch (RemoteException e) {
e.printStackTrace();
一、异常原因在使用aidl进行进程间通信时,有时候在客户端调用服务端的接口会抛出DeadObjectException异常,原因一般是由于某种原因服务端程序崩溃重启或者服务对象由于内存紧张被回收导致的,最近开发的时候遇到过此问题,解决方案有两种,实测有效。二、解决方案如下两种方案1. 方案一:针对应用开发,可以在服务端进程启动的时候发个消息给客户端,客户端收到消息的时候重新进行绑定操作,目的...
andorid.os.DeadObjectException
android.os.DeadObjectException 07-13 18:28:45.398: W/System.err(32272): at android.os.BinderProxy.transact(Native Method)
我们项目有2个进程
开发的过程中有时候会遇到DeadObjectException,说明系统service已经停止运行,解决的方式是在mainfistxml的application标签中添加android:hardwareAccelerated="false",禁用硬件加速。
转载于:https://www.cnblogs.com/henkun010/p/6566015.html...
碰到一个异常,具有随机性:
android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
at android.os.BinderProxy.transactNative(Native Method)
at android.o...
出现异常如下:
System.err: android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
10-30 09:51:08.151 3664 3682 W System.err: at android.os.BinderProxy.transac...
今天出现了android.os.DeadObjectException异常。那么DeadObjectException什么意思呢,字面意思当前对象“死”了,也就是没有了呗!那好首先来看看完全的log日志:
01-12 14:55:45.934 1240-1296/? W/WindowAnimator: Failed to dispatch window animation state change.
事情的起因是解决如何判断aidl服务端使用的客户端对象是否为同一个对象。于是引发了asBinder的使用,RemoteCallbackList使用,以及很少使用的IBinder.DeathRecipient。
此篇介绍可以帮助解决aidl使用中的生命周期控制、对象维护以及资源释放,保活服务问题。
当服务端接口有接收客户端aidl定制的对象时,例如维护一个listener列表。你可能需要避免相同对象被重复添加到集合。这个时候需要在服务端接口内对对象执行asBinder操作,此操作返回