无法启动服务com.android.vending.billing.IMarketBillingService

问题描述:

我试图启动com.android.vending.billing.IMarketBillingService服务,并收到此消息。我使用模拟器的Android 2.3.3 - API级别10无法启动服务com.android.vending.billing.IMarketBillingService

03-23 15:04:53.535: WARN/ActivityManager(61): Unable to start service Intent { act=com.android.vending.billing.IMarketBillingService }: not found 
03-23 15:04:53.535: ERROR/BillingService(416): Could not bind to service. 

代码:

private boolean bindToMarketBillingService() { 
    try { 
     if (Consts.DEBUG) { 
      Log.i(TAG, "binding to Market billing service"); 
     } 
     boolean bindResult = bindService(
       new Intent(IMarketBillingService.class.getName()), 
       this, 
       Context.BIND_AUTO_CREATE); 

     if (bindResult) { 
      return true; 
     } else { 
      Log.e(TAG, "Could not bind to service."); 
     } 
    } catch (SecurityException e) { 
     Log.e(TAG, "Security exception: " + e); 
    } 
    return false; 
} 

你添加IMarketBillingService.aidl你的包,然后重建项目?

如果你有尝试这个办法:

boolean bindResult = bindService(new Intent("com.android.vending.billing.MarketBillingService.BIND"), this, Context.BIND_AUTO_CREATE); 

工作对我来说