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