问题
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