【问题标题】:in app billing ServiceConnection is not initialized在应用计费 ServiceConnection 未初始化
【发布时间】:2015-05-03 23:51:47
【问题描述】:

我已经在我的应用程序中实现了应用内购买。我已遵循给定网址的所有步骤。

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

当我运行我的代码时,我在 mServiceConn 中遇到了空指针异常。我调试了代码,发现从来没有调用过onServiceConnected(),所以没有建立服务连接。

谁能帮我解决这个问题?

【问题讨论】:

  • 请发布您的代码的相关部分。

标签: android in-app-purchase


【解决方案1】:

在尝试找到合适的解决方案后的几个小时内,我对解决此问题感到意外地感到惊讶。在此之后我已成功完成测试购买:

  1. 通过本指南设置 GoogleApiClient - https://developer.android.com/google/auth/api-client.html。 我通过以下客户端设置从 Google Plus 服务获取 Google 帐户 ID:

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

  3. 在 beta chanel 中重新发布 apk

  4. 最后通过 Google+ 社区

  5. 将我的第二个帐户的访问权限设置为 beta 测试人员

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-07-23
    • 2020-08-26
    • 1970-01-01
    • 2021-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多