【发布时间】:2019-03-14 18:18:20
【问题描述】:
对不起,如果我的英语不好!
有人遇到过关于 fb 活动的问题吗?我在 Android 上有一个应用程序,它在 Google Play 上发布。最近我升级了它,然后我发现我的应用程序已经停止向 Analytics 发送任何事件。我的更改与 facebook SDK 无关。我只是更改了一些有关某些按钮工作逻辑的代码。
然后我尝试创建一个新的测试应用并检查它是否向 Google Analytics(分析)发送了事件。起初它有效,但几分钟后出现了同样的问题。第二天还是一样。。我没有看到分析中的任何事件。 我在应用中检查了集成SDK的步骤,一切都正确。
启动应用时出现日志错误:
11556-11580/com.pattern.eventstest E/GraphResponse: {HttpStatus: 400, errorCode: 100, subErrorCode: 33, errorType: GraphMethodException, errorMessage: Unsupported get request. Object with ID '147657836189003' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api}
但是,如果我没听错的话,那是因为应用程序带有 fb 授权按钮,但我没有在我的应用程序中使用它。
在 gradle 中,我尝试实现 'com.facebook.android:facebook-android-sdk:4.36.0' 和 'com.facebook.android:facebook-android-sdk:[4,5)',两者都不起作用。
有人知道发生了什么吗?
分级:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.pattern.eventstest"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'junit:junit:4.12'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
implementation group: 'commons-codec', name: 'commons-codec', version: '1.11'
implementation 'org.jsoup:jsoup:1.10.3'
}
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pattern.eventstest">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
</application>
</manifest>
字符串:
<resources>
<string name="app_name">Events Test</string>
<string name="facebook_app_id">147657836189003</string>
<string name="fb_login_protocol_scheme">fb147657836189003</string>
</resources>
MainActivity:
package com.pattern.eventstest;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.facebook.appevents.AppEventsLogger;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fbAppEvent(this, "onCreate");
}
public static void fbAppEvent(Context context, String name) {
String actName = "app: " + name;
try {
AppEventsLogger logger = AppEventsLogger.newLogger(context);
logger.logEvent(actName);
} catch (Exception e) {
e.printStackTrace();
}
}
}
【问题讨论】:
标签: android facebook facebook-android-sdk facebook-events facebook-analytics