expo: [expo-media-library] App crashes when getting video with getAssetsAsync on Android 8, 9

Summary

App crashes without error message when getting media including video with getAssetsAsync on Android 8 and 9. Hermes, JSC, Expo Go and Standalone all give the same result. Works fine on android 11 and iOS

“expo”: “^44.0.3”, “expo-media-library”: “~14.0.0”, // I also checked on 13.0.0

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android

SDK Version (managed workflow only)

44.0.3

Environment

Expo CLI 5.0.3 environment info: System: OS: Windows 10 10.0.19042 Binaries: Node: 14.15.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD npm: 7.20.3 - ~\AppData\Roaming\npm\npm.CMD IDEs: Android Studio: Version 4.1.0.0 AI-201.8743.12.41.6953283 npmPackages: expo: ^44.0.3 => 44.0.3 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 react-native: 0.64.3 => 0.64.3 react-native-web: 0.17.1 => 0.17.1 Expo Workflow: managed

Reproducible demo

import * as MediaLibrary from "expo-media-library";

try {
    const media = await MediaLibrary.getAssetsAsync({
            mediaType: [MediaLibrary.MediaType.video],     // [MediaLibrary.MediaType.photo] works find
        });
} catch (e) {
    console.log(e)
    // App crashes without error message on Android 8, 9
}

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 5
  • Comments: 18 (8 by maintainers)

Most upvoted comments

@superyarik No, I made it to only load photos on old devices(Platform.OS === “android” && Platform.Version < 29) Instead, I added a video album next to the photo album on Old Devices, and when the user presses video album, the image picker is launched. const imageObject = await ImagePicker.launchImageLibraryAsync({ mediaTypes: ImagePicker.MediaTypeOptions.Videos, quality: 1 }); On other devices, photos and videos are displayed together in each album, as originally intended.

isn’t there a fix yet?

Experienced Same Issue…!