-
Notifications
You must be signed in to change notification settings - Fork 0
[Fix] 릴리즈 모드일 때만 Crashlytics, Analytics 수집 되도록 수정 #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures Firebase Crashlytics and Analytics data collection only occur in release builds by leveraging build config flags and conditional runtime checks.
- Added conditional logic in
App.ktto disable collection in debug and enable in release. - Updated Gradle build setup to enable code shrinking in release and define
ENABLE_CRASHLYTICSbuild config flags per build type.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| app/src/main/java/com/eatssu/android/App.kt | Toggle Crashlytics and Analytics collection using BuildConfig.DEBUG checks |
| app/build.gradle.kts | Enable isMinifyEnabled for release, set up ENABLE_CRASHLYTICS flags, and incorrectly declare shrinkResources |
Comments suppressed due to low confidence (2)
app/src/main/java/com/eatssu/android/App.kt:39
- You’ve added
ENABLE_CRASHLYTICSbuild config flags in Gradle, but the runtime check still usesBuildConfig.DEBUG. Consider replacing this withBuildConfig.ENABLE_CRASHLYTICS(and a similar flag for analytics) to match your build config definitions.
if (BuildConfig.DEBUG) {
app/build.gradle.kts:49
shrinkResourcesshould be set using the Gradle propertyisShrinkResources, not a local variable. Update this line toisShrinkResources = false(andisShrinkResources = truein release if desired).
var shrinkResources = false
app/build.gradle.kts
Outdated
| getDefaultProguardFile("proguard-android-optimize.txt"), | ||
| "proguard-rules.pro" | ||
| ) | ||
| buildConfigField("Boolean", "ENABLE_CRASHLYTICS", "true") |
Copilot
AI
May 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The flag name ENABLE_CRASHLYTICS is used for both Crashlytics and Analytics. For clarity, consider defining separate flags (e.g., ENABLE_ANALYTICS) or renaming to something more general like ENABLE_FIREBASE_COLLECTION.
| buildConfigField("Boolean", "ENABLE_CRASHLYTICS", "true") | |
| buildConfigField("Boolean", "ENABLE_CRASHLYTICS", "true") | |
| buildConfigField("Boolean", "ENABLE_ANALYTICS", "true") |
kangyuri1114
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굿굿 신경 안썼던 gradle 다시 보게 되네요
app/build.gradle.kts
Outdated
| isMinifyEnabled = false | ||
| proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") | ||
|
|
||
| var shrinkResources = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var 필요 없지 않나요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var shrinkResources요? 없으면 에러나던디
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
허허 그렇네요 왜징
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var shrinkResources = false
이렇게 하면 그냥 안쓰는 변수를 코틀린으로 선언한거고

사진처럼 해야 하는 것 같아요
https://developer.android.com/build/migrate-to-kotlin-dsl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영했습니다!
Summary
Describe your changes
실물 기기 테스트가 필요합니다.