Skip to content

developmentDebug crashes on startup without app_keys.txt (Koin not started) #315

Description

@agammann

Steps to reproduce

Tested at commit 8062ee10a546fe408987366616cd5c4823b7e03c on an Android API 36 x86_64 emulator.

  1. Use a clean public checkout without app_keys.txt. The build script substitutes an empty string when this file is absent (androidApp/build.gradle.kts:37); the development flavor enables Lightning (line 73).
  2. Build :androidApp:assembleDevelopmentDebug, install the APK, and launch it.

Observed: the app crashes before its first screen. I reproduced this on two launches. One captured crash is shown below.

Captured AndroidRuntime excerpt

09-25 20:04:49.553 E/AndroidRuntime( 5645): FATAL EXCEPTION: main
09-25 20:04:49.553 E/AndroidRuntime( 5645): Process: com.greenaddress.greenbits_android_wallet.dev, PID: 5645
09-25 20:04:49.553 E/AndroidRuntime( 5645): Caused by: java.lang.IllegalStateException: KoinApplication has not been started
09-25 20:04:49.553 E/AndroidRuntime( 5645):     at com.blockstream.utils.Loggable.getKoin(Loggable.kt:9)
09-25 20:04:49.553 E/AndroidRuntime( 5645):     at com.blockstream.utils.Loggable.getLogger(Loggable.kt:11)
09-25 20:04:49.553 E/AndroidRuntime( 5645):     at com.blockstream.data.data.AppConfig$Companion.default(AppConfig.kt:31)
09-25 20:04:49.553 E/AndroidRuntime( 5645):     at com.blockstream.green.di.KoinAndroidKt.initKoinAndroid(KoinAndroid.kt:34)
09-25 20:04:49.553 E/AndroidRuntime( 5645):     at com.blockstream.green.GreenApplication.onCreate(GreenApplication.kt:35)

Why it crashes

When Lightning is enabled but the keys are absent, AppConfig.default calls its Koin-backed logger (data/src/commonMain/kotlin/com/blockstream/data/data/AppConfig.kt:30-32). initKoinAndroid constructs AppConfig first (androidApp/src/main/java/com/blockstream/green/di/KoinAndroid.kt:34-42) and only calls initKoin at line 44. The logger therefore reaches Koin before initialization.

As a diagnostic check, I removed only that early logging branch in a separate checkout and rebuilt. The app then reached the welcome screen and allowed creation of a disposable empty testnet wallet. That local change is not a complete proposed fix; the clean checkout remains unchanged.

Expected: the public no-key development build starts. This condition could be logged after Koin initializes or through a logger safe to use before initialization.

Scope: this is a locally built developmentDebug APK. I did not test an official signed production APK or claim that it crashes in production.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions