2013-12-19 44 views
7

我正在開發一個android項目,並試圖在應用程序結算V3中實施。未配置通過Google Play進行結算的應用程序

我已將我的應用上傳到Google Play,並嚮應用添加了IAP。我可以成功檢索我的應用程序的IAP列表以及其價格,但是當我實際嘗試進行購買時,我的設備出現以下錯誤(沒有錯誤

此版本的應用程序不是配置計費通過 谷歌Play下架。請訪問幫助中心以獲取更多信息。

下面是檢索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 c中的代碼ontains以下

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> 

感謝您的幫助,您可以提供

+0

要使用真實skus測試您的應用,您必須擁有與您上傳到Google Play相同的APK,即,apk使用相同的證書籤名 – yugidroid

回答

39

這裏要考慮幾件事情:

  1. 後將您的apk上傳到Google Play,您需要等待 Google服務器更新(與您發佈 更新類似)。根據我的經驗,這可能需要一兩個小時或更長的時間。所以 幾個小時後再試。

  2. 確保您上傳的apk版本配置爲 IAP(通過權限),然後僅測試帶有簽名 apk的IAP。也就是說,從Eclipse導出並簽署apk,然後在本地將 安裝到您的設備上。否則,如果您直接從IDE運行應用程序的未簽名版本 ,則它將不起作用,並且您將看到一個錯誤 。

    注意:只要當前上傳的draft apk配置了正確的權限,並且您在開發控制檯上發佈了您的IAP項目,則每次進行小的更改時都不需要上傳新的apk。唯一令人討厭的部分是,每次進行更改並在本地設備上運行應用程序時,都必須導出和簽名應用程序。

  3. 檢查您上傳的apk的versionCode與您的本地版本apk版本是否相同 versionCode。

  4. 由於Google電子錢包不允許您自行從 購買商品,因此您無法使用開發者帳戶進行購買測試, 。因此,您需要在開發人員控制檯 上設置一些測試帳戶,然後嘗試從運行測試 帳戶的設備購買項目。

+0

感謝您的幫助 – Boardy

+0

謝謝,我被困了一段時間,並且上面的第3點是問題!似乎我需要修改versionCode,提交新的APK,然後繼續測試,讓版本代碼在數小時內恢復正常,直到Google Play後端處理新的APK! – RobP

+2

該行:'檢查您上傳的apk的versionCode與您當地版本的apk有相同的versionCode .'對我非常有幫助。 –

相關問題