将服务与 interface 绑定时遇到错误stub()
。
这是我的连接代码:
class LogConnection implements ServiceConnection {
public void onServiceConnected(ComponentName className,
IBinder boundService) {
logService = ILogService.Stub.asInterface((IBinder) boundService);
}
但它不适合我。
日志猫:
06-22 12:17:28.632: I/dalvikvm(1973): Could not find method com.sam.logservice.ILogService$Stub.asInterface, referenced from method com.sam.logclient.LogClientActivity$LogConnection.onServiceConnected
06-22 12:17:28.662: W/dalvikvm(1973): VFY: unable to resolve static method 28: Lcom/sam/logservice/ILogService$Stub;.asInterface (Landroid/os/IBinder;)Lcom/sam/logservice/ILogService;
06-22 12:17:28.662: D/dalvikvm(1973): VFY: replacing opcode 0x71 at 0x0009
06-22 12:17:28.662: D/dalvikvm(1973): VFY: dead code 0x000c-0016 in Lcom/sam/logclient/LogClientActivity$LogConnection;.onServiceConnected (Landroid/content/ComponentName;Landroid/os/IBinder;)V
06-22 12:17:28.702: W/ActivityManager(61): Unable to start service Intent { cmp=com.sam.logclient/com.sam.logservice.ILogService }: not found
编辑: 我遵循以下链接的示例:
当我当时调试代码时,我在同一个位置敲击
logService = ILogService.Stub.asInterface((IBinder) boundService);
希望你有一些解决方案。
如果您想要更多数据来得出结论,请告诉我。