错误:ENOENT:没有这样的文件或目录expo-av

时间:2020-04-11 21:47:17

标签: react-native audio build expo

我正在使用带有expo-cli的react-native来构建应用程序,并且正在使用以下命令来构建apk:

expo build:android

但是我得到了错误:

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

关于我要使用以下代码在组件中导入的资产:

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);
      }
    }

0 个答案:

没有答案