facebook / facebook-android-sdk

Used to integrate Android apps with Facebook Platform.
https://developers.facebook.com/docs/android
Other
6.07k stars 3.64k forks source link

SDK should use isDebugEnabledField instead of BuildConfig.DEBUG #1238

Open marcin-adamczewski opened 1 month ago

marcin-adamczewski commented 1 month ago

Checklist before submitting a bug report

Java version

irrelevant

Android version

irrelevant

Android SDK version

irrelevant - exists on latest main branch

Installation platform & version

Gradle

Package

Core & AppEvents

Goals

AppEventUtility uses BuildConfig.DEBUG, which always returns false as you also claim in troubleshooting here https://developers.facebook.com/docs/android/troubleshooting/#faq_491357261067442 This code and probably other places in SDK should use FacebookSdk.isDebugEnabledField flag.

For example AppEventsLogger.clearUserID() should not be called on the main thread as it calls assertIsNotMainThread() inside. Because of this bug, developer doesn't know about it as the app wouldn't crash in debug mode and because this is not documented.

Expected results

Replace BuildConfig.DEBUG with FacebookSdk.isDebugEnabledField

Actual results

App didn't crash in debug, while it should

Steps to reproduce

No response

Code samples & details

// INSERT YOUR CODE HERE