2015-03-03 48 views
0

我在应用程序中实现了应用程序购买。我遵循给定网址的所有步骤。在应用程序结算中ServiceConnection未初始化

http://developer.android.com/google/play/billing/billing_integrate.html

当我运行我的代码在mServiceConn了空指针异常。我讨厌代码,发现onServiceConnected()永远不会被调用,所以serviceconnection没有建立。

任何人都可以帮助我吗?

+0

请张贴您的代码的相关部分。 – Okas 2015-03-03 15:35:47

回答

0

在试图找到合适的解决方案的几个小时内,出乎意料地解决了这个问题,我遇到了同样的问题。我已成功完成测试后购买这样的:

  1. 本指南建立GoogleApiClient - https://developer.android.com/google/auth/api-client.html。 我正在从谷歌加服务谷歌帐户ID与此客户端的设置:

    mGoogleApiClient = new GoogleApiClient.Builder(mContext) 
         .addApi(Plus.API) 
         .addScope(Plus.SCOPE_PLUS_PROFILE) 
         .addConnectionCallbacks(this) 
         .addOnConnectionFailedListener(this) 
         .build(); 
    
  2. 手动安装后并重新安装谷歌加服务 - 在测试香奈尔https://play.google.com/store/apps/details?id=com.google.android.gms

  3. 重新发布APK

  4. 最后设置访问为beta测试仪为我的第二个acco通过Google+社区