expo: error when compiling expo-image-picker 9.1.1(kotlin)
π Bug Report
kotlin cannot compile with expo-image-picker 9.1.1
Summary of Issue
i get the error below when i build project in android studio.
...node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/tasks/VideoResultTask.kt: (30, 112): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String?
Project gradle:
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
//FCM
classpath("com.google.gms:google-services:4.3.4")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Environment - output of expo diagnostics & the platform(s) youβre targeting
Expo CLI 3.28.0 environment info: System: OS: macOS 10.15.5 Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.19.0 - /usr/local/bin/node npm: 6.14.8 - /usr/local/bin/npm Managers: CocoaPods: 1.9.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.2, DriverKit 20.0, macOS 11.0, tvOS 14.2, watchOS 7.1 IDEs: Android Studio: 4.1 AI-201.8743.12.41.6858069 Xcode: 12.2/12B5025f - /usr/bin/xcodebuild npmPackages: expo: ~39.0.2 => 39.0.4 react: 16.13.1 => 16.13.1 react-dom: 16.13.1 => 16.13.1 react-native: ~0.63.3 => 0.63.3 react-native-web: ~0.13.12 => 0.13.18 npmGlobalPackages: expo-cli: 3.28.0 Expo Workflow: bare
Reproducible Demo
Everything is working in simulators and even expo client. no problem is during compile.
Steps to Reproduce
compile project with the above gradle settings
Expected Behavior vs Actual Behavior
Project should build successfully. In my case the following lines in expo-image-picker fails.
putInt("width", mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH).toInt())
putInt("height", mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT).toInt())
putInt("rotation", mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION).toInt())
putInt("duration", mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION).toInt())
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 15 (6 by maintainers)
I resolved it by setting the following in the android/build.gradle file
Under dependencies:- classpath βorg.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0β
ext { buildToolsVersion = β29.0.2β minSdkVersion = 23 compileSdkVersion = 29 targetSdkVersion = 29 kotlinVersion = β1.4.0β androidXCore = β1.6.0β }
Hope that helps
I resolved this issue by updating react-native-unimodules. Hereβs how to set it. docs
Updating react-native-unimodules was also the only thing that worked for me
Fixed by https://github.com/expo/expo/pull/11552. Please check the newest versions -> 10.0.0.