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.
Summary
On Expo SDK 56 (
expo-modules-core@56.x),@siteed/audio-studiofails to compile on Android because its anonymousPromiseimplementations overridereject(code: String, …)with a non-nullcode, while the currentexpo.modules.kotlin.Promiseinterface declarescodeas 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-modules-core56.0.14app:assembleDebug(Android, arm64-v8a), Kotlin via AGP 8.12Error
Root cause
expo-modules-core'sPromiseinterface now declares:but the library implements
object : Promise { override fun reject(code: String, message: String?, cause: Throwable?) … }(non-nullcode). 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.ktpackages/audio-studio/android/src/main/java/net/siteed/audiostudio/AudioStudioModule.ktpackages/audio-studio/android/src/main/java/net/siteed/audiostudio/AudioRecordingService.ktpackages/audio-studio/android/src/main/java/net/siteed/audiostudio/RecordingActionReceiver.ktFix
Change every
override fun reject(code: String, message: String?, cause: Throwable?)tocode: String?so it matches the interface. This is source-compatible with older expo-modules-core versions too (the bodies don't depend oncodebeing non-null).I'll open a PR with this change.