#How do I load images from Android internal assets in Tauri 2.0?

3 messages · Page 1 of 1 (latest)

tribal yarrow
#

i'm tried

let rd = await resourceDir();
const filePath = await join(rd, 'resources/img/test.png')
const fileUrl = convertFileSrc(filePath);
if (imageRef.current) {
    imageRef.current.src = fileUrl
}

it works on ios and macos
but, android return No such file or directory(os error 2)

quaint cobalt
#

please note with android path api still underdevelopment ... so use dialog open ... the path api is stuck in the /Android/data/com.appname/*

#

e.g. the correct path for downloadDir() is /Android/Download but the directory is /Android/data/com.appname/file/Download