Minimal repro demonstrating that the Statsig Android SDK does not serve previously-cached values during the initialization window. On a second launch, even though the SDK has values persisted to disk from the previous session's network response, reads before isInitialized() returns true still return hardcoded defaults.
In apps with complex startup (DI, multi-module init), there is a window between app launch and Statsig.initializeAsync() completing where Statsig.isInitialized() returns false. During this window, any parameter reads return the caller's hardcoded default — not the values the SDK cached to disk from the last successful network response.
This forces app developers to build their own caching layer (e.g. SharedPreferences) to serve last-known values during the pre-init window.
- Install and launch the app (Run #1)
- Wait for the "Restart app" button to activate (indicates network fetch completed and values are cached to disk)
- Tap "Restart app" for a cold restart
- Observe Run #2: pre-init reads still return defaults despite cached values on disk
Pre-init reads return defaults (expected — SDK hasn't been initialized). After initializeAsync, values resolve from the bundled config. The updateUser call fetches from network and caches to disk.
Pre-init reads still return defaults, even though the SDK has values cached from Run #1's network fetch. Post-init reads now resolve from the disk cache (note wait_time_in_seconds = 77.0 and home_screen_title = this is the test headline — different from the bundled config's 42.0).
On Run #2, pre-init reads should serve the cached values from the previous session rather than returning defaults. The SDK has this data on disk — it should be available immediately without waiting for full initialization.
StatsigOptions(
api = "https://www.nytimes.com/statsig",
eventLoggingAPI = "https://www.nytimes.com/statsig",
enableAutoValueUpdate = true,
autoValueUpdateIntervalMinutes = 60.0,
onDeviceEvalAdapter = OnDeviceEvalAdapter(data = bundledConfigJson),
initializeOffline = true,
)- SDK version:
com.statsig:android-sdk:4.45.6 initializeOffline = truewithOnDeviceEvalAdapter(bundled config from build time)- After init,
Statsig.updateUser()is called (matching production behavior), which triggers a network fetch and caches the response to disk
- Replace
sdkKeyinCacheIssueApp.ktwith a valid client SDK key - The bundled config in
res/raw/statsig_client_config_bundle.jsonmust match the SDK key's project
./gradlew :app:assembleDebug
adb install app/build/outputs/apk/debug/app-debug.apkUninstall to reset run counter: adb uninstall com.example.cacheissue


