Error: ENOENT: no such file or directory expo-av

岁酱吖の 提交于 2020-04-18 06:10:34

问题


I'm building an application using react-native with expo-cli and I'm building the apk using the command:

expo build:android

but I get the error:

Error: ENOENT: no such file or directory, open 'C:\Users\Ahmed Hassan\Desktop\app-name\assets\sounds\alert.mp3'

regarding the asset I'm importing in a component with the following code:

import { Audio } from 'expo-av';

    async function sound() {
      const soundObject = new Audio.Sound();
      try {
        await soundObject.loadAsync(require('../assets/sounds/alert.mp3'));
        await soundObject.playAsync();
      } catch (error) {
        console.log(error);
      }
    }

来源:https://stackoverflow.com/questions/61164119/error-enoent-no-such-file-or-directory-expo-av

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!