File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,6 +109,22 @@ android {
109109 testApplicationId = " com.ichi2.anki.tests"
110110 vectorDrawables. useSupportLibrary = true
111111 testInstrumentationRunner = ' com.ichi2.testutils.NewCollectionPathTestRunner'
112+
113+ // GA4 Measurement Protocol api_secret. Sourced from `local.properties`
114+ // (ANALYTICS_API_KEY) or the ANALYTICS_API_KEY env var; falls back to
115+ // a dummy value so contributor builds still compile.
116+ //
117+ // The dummy key is rejected by GA's ingest, so analytics requests from
118+ // unsigned/local builds go nowhere this means `setDevMode()` (100%
119+ // sampling) has no observable effect on a build without the real key.
120+ Properties properties = new Properties ()
121+ def localPropsFile = project. rootProject. file(" local.properties" )
122+ if (localPropsFile. exists()) {
123+ properties. load(localPropsFile. newDataInputStream())
124+ }
125+
126+ def apiKey = properties. getProperty(" ANALYTICS_API_KEY" ) ?: System . getenv(" ANALYTICS_API_KEY" ) ?: " DUMMY_API_XXX"
127+ buildConfigField " String" , " ANALYTICS_API_KEY" , " \" ${ apiKey} \" "
112128 }
113129 signingConfigs {
114130 release {
You can’t perform that action at this time.
0 commit comments