【问题标题】:Application not configured for billing through Google Play应用程序未配置为通过 Google Play 计费
【发布时间】:2013-12-19 21:52:21
【问题描述】:

我正在开发一个 android 项目,我正在尝试实施 In App Billing V3。

我已将我的应用上传到 Google Play,并为该应用添加了 IAP。我可以成功检索我的应用程序的 IAP 列表及其价格,但是当我实际尝试购买时,我的设备出现以下错误(

中没有错误

此版本的应用程序未配置为通过计费 谷歌播放。查看帮助中心了解更多信息。

下面是检索可用 IAP 并进行购买的代码

ArrayList skuList = new ArrayList();
        skuList.add("mysqlmanager_pro");

        Bundle querySkus = new Bundle();
        querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
        try
        {
            Bundle skuDetail = mService.getSkuDetails(3, getPackageName(), "inapp", querySkus);
            Log.d("Billing", "Response Received");

            int billingResponse = skuDetail.getInt("RESPONSE_CODE");
            if (billingResponse == 0)
            {
                //Get list of IAP's to purcase - NOT NEEDED
                ArrayList responseList = skuDetail.getStringArrayList("DETAILS_LIST");

                Log.d("Billing", "Response");

                Bundle buyIntentBundle = mService.getBuyIntent(3, getPackageName(), 
                        "mysqlmanager_pro", "inapp", "");

                PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");

                startIntentSenderForResult(pendingIntent.getIntentSender(), 
                        Defines.IntentRequestCodes.IAP_PURCHASE_REQUEST, new Intent(), 
                        Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0));
                /*for (String thisResponse : responseList)
                {
                    JSONObject object = new JSONObject(thisResponse);
                    String sku = object.getString("productid");
                    String price = object.getString("price");
                }*/
            }

        }
        catch (Exception ex)
        {
            Log.e("Billing", ex.toString());
        }

我的 onCreate 包含以下内容

mServiceConn = new ServiceConnection() {

            @Override
            public void onServiceDisconnected(ComponentName name) {
                mService = null;
            }

            @Override
            public void onServiceConnected(ComponentName name, IBinder service) {
                mService = IInAppBillingService.Stub.asInterface(service);
            }
        };

        bindService(new Intent("com.android.vending.billing.InAppBillingService.BIND"), 
                mServiceConn, Context.BIND_AUTO_CREATE);

下面是我的清单文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.BoardiesITSolutions.MysqlManager"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="18" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.android.vending.BILLING" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.BoardiesITSolutions.MysqlManager.Agreement"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity 
            android:name=".MainActivity"
            android:label="@string/app_name">
        </activity>
        <activity
            android:name=".NewDBConnection"
            android:label="@string/new_mysql_connection">
        </activity>
        <activity
            android:name=".ConnectionManager"
            android:label="@string/connection_manager">
            <meta-data 
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".MainActivity"/>
        </activity>
        <activity
            android:name=".EditDBConnections"
            android:label="@string/edit_database_connections">
        </activity>
        <activity
            android:name=".ServerStatus"
            android:label="Server Status">
            <meta-data 
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".ConnectionManager"/>
        </activity>
        <activity 
            android:name=".ConnectedDBManagerHost"
            android:label="Connected to DB">
        </activity>
        <receiver android:name="BillingReceiver">
      <intent-filter>
        <action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
        <action android:name="com.android.vending.billing.RESPONSE_CODE" />
        <action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
      </intent-filter>
    </receiver>
    </application>

</manifest>

感谢您提供的任何帮助

【问题讨论】:

  • 要使用真实 sku 测试您的应用,您必须拥有与上传到 Google Play 相同的 APK,即使用相同证书签名的 apk

标签: android in-app-purchase


【解决方案1】:

这里有几点需要考虑:

  1. 将您的 apk 上传到 Google Play 后,您需要等待一段时间 供 Google 的服务器更新(类似于您发布 更新)。根据我的经验,这可能需要一两个小时或更长时间。所以 几小时后再试。

  2. 确保您上传的 apk 版本配置为 IAP(通过权限),然后只测试带有签名的 IAP APK。也就是说,从 Eclipse 导出并签署您的 apk,然后安装 本地到您的设备上。否则,如果您运行未签名的版本 直接从 IDE 中的应用程序,它将无法工作并且 你会看到一个错误。

    注意:您无需在每次进行细微更改时都上传新的 apk,只要当前上传的草稿 apk 配置了正确的权限并且您在开发控制台上发布了 IAP 项目即可。唯一烦人的部分是您必须在每次进行更改后导出并签署您的应用程序并在本地设备上运行它。

  3. 检查你上传的apk的versionCode是否相同 versionCode 作为您本地版本的 apk。

  4. 您不能使用您的开发者帐户进行测试购买, 因为 Google 电子钱包不允许您从 你自己。所以需要在Developer上设置一些测试账号 控制台并尝试从运行测试的设备购买物品 帐户。

【讨论】:

  • 谢谢,我被难住了一会儿,上面的第 3 点就是问题所在!看来我需要提高版本代码,提交新的 APK,然后继续测试,将版本代码降低几个小时,直到 Google Play 后端处理新的 APK!
  • 线路:Check that the versionCode of your uploaded apk has the same versionCode as your local version of the apk. 对我很有帮助。
  • 应该发布提交的apk还是我可以将其保留为prod中的草稿?
  • 需要通过复制到 SDCARD 中手动安装来运行
  • 我一直在与类似但不完全相同的问题作斗争。另一个问题有有用的答案:stackoverflow.com/questions/11068686/…
猜你喜欢
  • 1970-01-01
  • 2012-06-19
  • 1970-01-01
  • 2012-11-22
  • 1970-01-01
  • 2012-12-03
  • 2014-04-20
  • 2014-04-25
相关资源
最近更新 更多