2017-11-24 14 views
0

Googleのアプリ内課金をテストしています。私はIabHelperを使って、Googleのアプリ内課金トレーニングの指示に従います。Googleのアプリ内課金、サーバーからの情報の取得中にエラーが発生しました[DF-DFERH-01]

IabHelperを正常にセットアップしました。

mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { 
     public void onIabSetupFinished(IabResult result) { 
      Log.d("GooglePay", "Setup finished."); 

      if (!result.isSuccess()) { 
       // Oh no, there was a problem. 
       Log.d("GooglePay", "Problem setting up in-app billing: " + result); 
       return; 
      } 

      // Have we been disposed of in the meantime? If so, quit. 
      if (mHelper == null) return; 

      mBroadcastReceiver = new IabBroadcastReceiver(GooglePayPlugin.this); 
      IntentFilter broadcastFilter = new IntentFilter(IabBroadcastReceiver.ACTION); 
      mActivity.registerReceiver(mBroadcastReceiver, broadcastFilter); 
     } 
    }); 

次に、IabHelperの購入APIを呼び出します。

try { 
    mHelper.launchPurchaseFlow(mActivity, productID, RC_REQUEST, 
       mPurchaseFinishedListener, payload); 
} catch (IabAsyncInProgressException e) { 
    Log.d("GooglePay", "Error launching purchase flow. Another async operation in progress."); 
} 

しかし、私は常にポップアップウィンドウを持って言う: "从服务器检索信息时出错[DF-DFERH-01]。"、下図のように。 enter image description here

logcat情報はアタッチされています。

+0

logcatリンク:http://note.youdao.com/noteshare?id = 654efa3f235e49e82023d7d11300ef13 – user2314244

+0

あなたのコードには何が 'productID'ですか? – rockstar

+0

@rockstar Google Playストアで設定された実際の商品IDを使用します。私は商品IDが正しいことを二重チェックしました – user2314244

答えて

0

私はこの問題を最終的に解決しました。私の答えをここに入れて、私のような同じ問題を抱えた人を助けてくれることを願っています。

mHelper.launchPurchaseFlow(mActivity、productID、RC_REQUEST、 mPurchaseFinishedListener、payload);

"payLoad"パラメータが長すぎます。ペイロードを空の文字列に設定しました。問題は解決されました。これ以上のdf-dferh-01はありません。

VPNとは関係がありません.Googleライブラリとは関係ありません。ペイロードがGoogle Playサービスのインターフェースには長すぎるからです。

1

次の手順を使用してコードをチェックしてください:

STEP:sdk toolsdk managerGoogle Play Billing LibraryGoogle play servicesで更新されて1つの チェック

STEP:2 は、Androidプロジェクトを作成し、請求書を追加Androidプロジェクトのマニフェストファイルへのアクセス許可

<uses-permission android:name="com.android.vending.BILLING" /> 
<uses-permission android:name="android.permission.INTERNET" /> 

STEP:3 右あなたのアプリレベルのフォルダ>>フォルダ>> AIDLフォルダ

2をクリックしてプロジェクト

1.ByにAIDLファイルを追加します。アプリ内課金用のディレクトリまたはフォルダまたはパッケージを作成する例 - > com.android.vending.billing

3.このパッケージにコピーしたファイル

このすべてをやった後、あなたはそれがbuild.gradleと com.android.vending.billingのためのディレクトリを再調整するために行く解決するために、その InAppBillingService.aidlをインポートするためのIabHelperよう 支援クラスを課金他のInAppでエラーが発生します

sourceSets {メイン{aidl.srcDirs = [ 'SRC /メイン/ AIDL']}のようなディレクトリまたは パッケージ作成

をcom.android.vending.billing時 正しい形式れません}

ステップ:3 ビルドの依存関係を更新します。4 Googleとの接続が

base64EncodedPublicKeyがあなたの製品のために右であることを確認してください)

Base64EncodedPublicKeyyour license key from google play consoleを意味する)

/************Setting Up Google Play Billing in the Application***************/ 
    mHelper = new IabHelper(this, base64EncodedPublicKey); 

    // enable debug logging (for a production application, you should set this to false). 
    // mHelper.enableDebugLogging(true); 
    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { 
     public void onIabSetupFinished(@NonNull IabResult result) { 
      if (!result.isSuccess()) { 
       Log.d(TAG, "In-app Billing setup failed: " + result); 
       complain("In-app Billing setup failed:: " + result); 

      } else { 
       Log.d(TAG, "In-app Billing is set up OK"); 
      } 
     } 
    }); 
    /************Setting Up Google Play Billing in the Application***************/ 
を再生開始:STEPはGradleのファイル

STEP:item_sku次のテスト目的での使用のために5

static final String ITEM_SKU = "android.test.purchased"; 
static final int RC_REQUEST = 10001; 

ライブ使用の場合は、作成しているProductIDを生きます。

STEP:6

  1. が実装OnIabPurchaseFinishedListener

  2. 実装結果

    @Override 
    protected void onActivityResult(int requestCode, int resultCode,Intent data) 
    { 
    if (!mHelper.handleActivityResult(requestCode, resultCode, data)) { 
        super.onActivityResult(requestCode, resultCode, data); 
    } 
    } 
    
  3. を処理するためonActivityResultメソッドの実装QueryInventoryFinishedListener

  4. OnConsumeFinishedListener

STEP実装:8

IabHelperの購入APIを呼び出す:7

をお使いのデバイスがGoogle play services

STEPを更新したことを確認してください。

mHelper.launchPurchaseFlow(mActivity, ITEM_SKU, 
       RC_REQUEST,mPurchaseFinishedListener, mPayload); 

STEP:私は、これはあなたを助けることを願っています

https://developer.android.com/google/play/billing/billing_integrate.html#billing-permission

https://developer.android.com/google/play/billing/billing_library.html#connecting

:詳細については9 次のリンクを参照してください。

+0

これらの手順を確認して試しましたが、それでも動作しません。 – user2314244

関連する問題