2015-10-29 356 views
3

我實現Appsflyer我的樣本項目,但是當我運行它,服務器返回錯誤代碼400AppsFlyer返回狀態碼400

I/AppsFlyer_1.18-117182240: response code: 400 

還有就是我MainActivty.java

public class MainActivity extends AppCompatActivity { 

public static final String LOG_TAG = "AppsFlyerSampleApp"; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 
    setSupportActionBar(toolbar); 

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); 
    fab.setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View view) { 
      Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) 
        .setAction("Action", null).show(); 
     } 
    }); 
    // Set the Currency 
    AppsFlyerLib.setCurrencyCode("USD"); 

    // The Dev key cab be set here or in the manifest.xml 
    AppsFlyerLib.setAppsFlyerKey("aaaa"); 
    AppsFlyerLib.sendTracking(this); 

    AppsFlyerLib.registerConversionListener(this, new AppsFlyerConversionListener() { 
     public void onInstallConversionDataLoaded(Map<String, String> conversionData) { 
      DebugLogQueue.getInstance().push("\nGot conversion data from server"); 
      for (String attrName : conversionData.keySet()) { 
       Log.d(LOG_TAG, "attribute: " + attrName + " = " + conversionData.get(attrName)); 
      } 
     } 

     public void onInstallConversionFailure(String errorMessage) { 
      Log.d(LOG_TAG, "error getting conversion data: " + errorMessage); 
     } 

     public void onAppOpenAttribution(Map<String, String> attributionData) { 
      printMap(attributionData); 
     } 

     public void onAttributionFailure(String errorMessage) { 
      Log.d(LOG_TAG, "error onAttributionFailure : " + errorMessage); 

     } 

     private void printMap(Map<String, String> map) { 
      for (String key : map.keySet()) { 
       Log.d(LOG_TAG, key + "=" + map.get(key)); 
      } 

     } 
    }); 
} 

和我清單文件。

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.example.afapplication"> 

<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> 
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"> 
    <activity 
     android:name=".MainActivity" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme.NoActionBar"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
     <intent-filter> 
      <action android:name="android.intent.action.VIEW" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
      <category android:name="android.intent.category.BROWSABLE" /> 
      <data android:scheme="appsflyer" /> 
      <!--<data android:scheme="http"--> 
      <!--android:host="sometest.com" />--> 
     </intent-filter> 
    </activity> 

    <receiver 
     android:name="com.appsflyer.MultipleInstallBroadcastReceiver" 
     android:exported="true"> 
     <intent-filter> 
      <action android:name="com.android.vending.INSTALL_REFERRER" /> 
     </intent-filter> 
    </receiver> 
    <receiver android:name="com.appsflyer.AppsFlyerLib"> 
     <intent-filter> 
      <action android:name="android.intent.action.PACKAGE_REMOVED" /> 
      <data android:scheme="package" /> 
     </intent-filter> 
    </receiver> 
</application> 

我不知道爲什麼服務器輸出錯誤代碼400?
有沒有其他人有類似的情況?

+0

你知道這是什麼錯誤意味着什麼?它說你的要求不好。所以請檢查你的發送。 –

+0

謝謝Thomas R.我知道這個錯誤的意思。但是請求發送由Appsflyer構建的自動。 – Naviart

+0

也許你忘了設置一些數據?或者數據損壞? –

回答

0

我認爲你應該檢查你的applicationId,並確保你已經在Appsflyer儀表板中使用相同的applicationId創建了你的應用程序。

我有同樣的錯誤代碼,直到我發現的applicationID一個錯字我進入到創建Appsflyer我的測試應用程序...

希望這將有助於

相關問題