Flutter build fails with Kotlin type inference error when using tamara_flutter_sdk versions 1.0.13 through 1.0.17:
e: file:///Users/khairi/.pub-cache/hosted/pub.dev/tamara_flutter_sdk-1.0.17/android/src/main/kotlin/co/tamara/sdk/util/SingleLiveEvent.kt:22:23
Type inference failed. The value of the type parameter 'T' should be mentioned in input types (argument types, receiver type, or expected type). Try to specify it explicitly.
Running Gradle task 'assembleDebug'...
e: file:///Users/username/.pub-cache/hosted/pub.dev/tamara_flutter_sdk-1.0.17/android/src/main/kotlin/co/tamara/sdk/util/SingleLiveEvent.kt:22:23 Type inference failed. The value of the type parameter 'T' should be mentioned in input types (argument types, receiver type, or expected type). Try to specify it explicitly.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':tamara_flutter_sdk:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 14s
Error: Gradle task assembleDebug failed with exit code 1
Environment
- Flutter: 3.32.8
- Dart: 3.8.1
- Android compileSdkVersion: 35
- Kotlin/Java target: 17
- tamara_flutter_sdk: ^1.0.16 (also tested 1.0.13, 1.0.15, 1.0.17)
Reproduction Steps
- Add tamara_flutter_sdk: ^1.0.16 to pubspec.yaml
- Run flutter pub get
- Run flutter run on Android device
- Build fails at Kotlin compilation step
Root Cause
The issue is in SingleLiveEvent.kt line 22 where Kotlin's stricter type inference (in newer Kotlin versions) requires explicit type parameters that aren't provided in the SDK code.
Attempted Solutions
- ✅ Tried multiple SDK versions (1.0.13, 1.0.15, 1.0.16, 1.0.17) - all fail
- ✅ Added Kotlin compiler flags (-Xallow-result-return-type)
- ✅ Verified Android Gradle Plugin and Kotlin configurations
- ✅ Cleaned Flutter and Gradle caches
Flutter build fails with Kotlin type inference error when using tamara_flutter_sdk versions 1.0.13 through 1.0.17:
e: file:///Users/khairi/.pub-cache/hosted/pub.dev/tamara_flutter_sdk-1.0.17/android/src/main/kotlin/co/tamara/sdk/util/SingleLiveEvent.kt:22:23
Type inference failed. The value of the type parameter 'T' should be mentioned in input types (argument types, receiver type, or expected type). Try to specify it explicitly.
Environment
Reproduction Steps
Root Cause
The issue is in SingleLiveEvent.kt line 22 where Kotlin's stricter type inference (in newer Kotlin versions) requires explicit type parameters that aren't provided in the SDK code.
Attempted Solutions