通过 Facebook SDK 将事件发送到分析时出现问题

Problem with sending events to analytics over Facebook SDK

我使用 com.facebook.android:facebook-core:5.0.0 当我尝试像这样向分析发送事件时

val logger = AppEventsLogger.newLogger(context, "my_app_id")  
logger.logEvent("event", Bundle())

但是我的日志有错误

    E/GraphResponse: {HttpStatus: 404, errorCode: 803, subErrorCode: -1,  
 errorType: OAuthException, errorMessage: (#803) Some of the aliases you  
 requested do not exist: "my_app_id"}

应用的设置与 https://developers.facebook.com/quickstarts/?platform=android

中的一样

Facebook 的支持不回答

我用两点修正:

1: 在清单中添加两个活动。

<activity android:name="com.facebook.FacebookActivity"
          android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
          android:label="@string/app_name"/>

<activity android:name="com.facebook.CustomTabActivity"
          android:exported="true">
    <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="@string/fb_login_protocol_scheme"/>
    </intent-filter>
</activity>  

2: 将 app/build.gradle 中的 manifestPlaceholders 替换为

resValue "string", "facebook_app_id", "$fbAppId"  
resValue "string", "fb_login_protocol_scheme", "fb$fbAppId"

我不知道为什么 manifestPlaceholders 不起作用。