1
我在面向stub()
綁定服務時遇到錯誤。Android綁定服務調用接口問題`
這裏是我的連接代碼:
class LogConnection implements ServiceConnection {
public void onServiceConnected(ComponentName className,
IBinder boundService) {
logService = ILogService.Stub.asInterface((IBinder) boundService);
}
,但它不是爲我工作。
的logcat:
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);
希望你有一些解決方案。
請讓我知道你是否想要更多的數據來推斷原因。
no..I在另一個包中綁定服務..它不工作 – NovusMobile
發表一些代碼可以在另一個包中綁定服務很好.. – MobileEvangelist