Skip to content

[BUG] Android: compileDebugKotlin fails on Expo SDK 56 — Promise.reject(code) is now nullable (String?) #416

@pablogdcr

Description

@pablogdcr

Summary

On Expo SDK 56 (expo-modules-core@56.x), @siteed/audio-studio fails to compile on Android because its anonymous Promise implementations override reject(code: String, …) with a non-null code, while the current expo.modules.kotlin.Promise interface declares code as nullable (String?). Kotlin therefore treats the override as not implementing the interface method.

Environment

  • @siteed/audio-studio: 3.2.0 (also reproduces on 3.0.3)
  • Expo SDK 56, React Native 0.85, expo-modules-core 56.0.14
  • Build: app:assembleDebug (Android, arm64-v8a), Kotlin via AGP 8.12

Error

> Task :siteed-audio-studio:compileDebugKotlin FAILED
e: …/net/siteed/audiostudio/AudioRecorderManager.kt:224:40
   Class '<anonymous>' is not abstract and does not implement abstract member:
   fun reject(code: String?, message: String?, cause: Throwable?): Unit
e: 'reject' overrides nothing. Potential signatures for overriding:
   fun reject(code: String?, message: String?, cause: Throwable?): Unit
   fun reject(exception: CodedException): Unit

Root cause

expo-modules-core's Promise interface now declares:

fun reject(code: String?, message: String?, cause: Throwable?)

but the library implements object : Promise { override fun reject(code: String, message: String?, cause: Throwable?) … } (non-null code). The parameter nullability mismatch means the override matches nothing and the abstract member is left unimplemented.

Affected files (18 overrides)

  • packages/audio-studio/android/src/main/java/net/siteed/audiostudio/AudioRecorderManager.kt
  • packages/audio-studio/android/src/main/java/net/siteed/audiostudio/AudioStudioModule.kt
  • packages/audio-studio/android/src/main/java/net/siteed/audiostudio/AudioRecordingService.kt
  • packages/audio-studio/android/src/main/java/net/siteed/audiostudio/RecordingActionReceiver.kt

Fix

Change every override fun reject(code: String, message: String?, cause: Throwable?) to code: String? so it matches the interface. This is source-compatible with older expo-modules-core versions too (the bodies don't depend on code being non-null).

I'll open a PR with this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions