Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] bundleresources is not working for Android #8911

Open
vangork opened this issue Feb 20, 2024 · 7 comments
Open

[bug] bundleresources is not working for Android #8911

vangork opened this issue Feb 20, 2024 · 7 comments
Labels
platform: Android status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@vangork
Copy link

vangork commented Feb 20, 2024

Describe the bug

It won't bundle the resources specified in the bundleresources config for Android (yarn tauri android dev). Does this option apply to Android?

"bundle": {
    "resources": [
        "resources/*"
    ]
}

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22000 X64
    ✔ WebView2: 121.0.2277.128
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.71.0 (8ede3aae2 2023-07-12)
    ✔ cargo: 1.71.0 (cfd3bbd8f 2023-06-08)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 18.16.0
    - yarn: 1.22.19
    - npm: 9.5.1

[-] Packages
    - tauri [RUST]: 2.0.0-alpha.21
    - tauri-build [RUST]: 2.0.0-alpha.14
    - wry [RUST]: 0.35.2
    - tao [RUST]: 0.24.0
    - tauri-cli [RUST]: 1.3.1
    - @tauri-apps/api [NPM]: 2.0.0-alpha.13
    - @tauri-apps/cli [NPM]: 2.0.0-alpha.20

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

Stack trace

No response

Additional context

No response

@vangork vangork added status: needs triage This issue needs to triage, applied to new issues type: bug labels Feb 20, 2024
@wyatt-herkamp
Copy link

I am having the same issue.

@wyatt-herkamp
Copy link

wyatt-herkamp commented Apr 2, 2024

I am using this for a school project. I found a workaround. By making a zip file in the build.r.s and using include_bytes. Then I extract the files if needed. I know it isn't the best option. However, this is a small school project.

@vangork
Copy link
Author

vangork commented Apr 6, 2024

@wyatt-herkamp FYI. I just follow android doc and handle the files with an android plugin.

@loikki
Copy link

loikki commented May 16, 2024

I had the same issue and decided to move towards using this library https://github.com/pyrossh/rust-embed. It works very well and simplifies a lot the data management.

@biaggii
Copy link

biaggii commented Jan 4, 2025

I had the same issue, i can used resource by typescript frontend, but rustend can't

@oddpxl
Copy link

oddpxl commented Jan 20, 2025

It works just fine on MacOS.

Android --> get no file when DEV --> get a small piece of html when BUILD

Indeed seems Tauri path resolver return tauri://localhost paths instead of fs paths
thewh1teagle/sherpa-rs#59

When I unpack my APK --> I see the file embedded:
2327524 01-01-1981 01:01 assets/models/silero_vad.onnx

--- pnpm tauri android dev
2025-01-20T04:08:24.034Z ==== ANDROID RESOURCE CHECK ====
2025-01-20T04:08:24.034Z 🔍 Trying path: assets/models/silero_vad.onnx
2025-01-20T04:08:24.035Z ❌ Error: ❌ Missing: silero_vad.onnx

--- pnpm tauri android build ( and signed )
I get a tiny piece of HTML ( 538 bytes ) instead of the embedded file.

2025-01-20T04:28:30.869Z ==== ANDROID RESOURCE CHECK ====
2025-01-20T04:28:30.869Z 🔍 Trying path: silero_vad.onnx
2025-01-20T04:28:30.869Z 📦 Asset size: 583 bytes (0.00 MB)
2025-01-20T04:28:30.869Z 🔍 Trying path: models/silero_vad.onnx
2025-01-20T04:28:30.869Z 📦 Asset size: 583 bytes (0.00 MB)
2025-01-20T04:28:30.870Z 🔍 Trying path: assets/models/silero_vad.onnx
2025-01-20T04:28:30.870Z 📦 Asset size: 583 bytes (0.00 MB)
2025-01-20T04:28:30.870Z ❌ Error: ❌ Missing: silero_vad.onnx
(tried paths: ["silero_vad.onnx", "models/silero_vad.onnx", "assets/models/silero_vad.onnx"])

--- tauri.conf.json
{
"productName": "tauri-mobile-neo",
"version": "0.0.1",
"identifier": "com.odd.dev",
"build": {
"beforeDevCommand": "pnpm dev",
"devUrl": "http://localhost:1420",
"beforeBuildCommand": "pnpm build",
"frontendDist": "../dist"
},
"app": {
"windows": [
{
"title": "tauri-mobile-neo",
"width": 800,
"height": 1000
}
],
"security": {
"csp": null }
},
"bundle": {
"active": true,
"targets": "all",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"resources": [
"models/**/*"
]
}
}

--- AndroidManifest.xml

--- capabilities/mobile.json
{
"$schema": "../gen/schemas/mobile-schema.json",
"identifier": "mobile-capability",
"windows": ["main"],
"platforms": ["iOS", "android"],
"permissions": [
"barcode-scanner:allow-scan",
"barcode-scanner:allow-cancel",
"barcode-scanner:allow-open-app-settings",
"barcode-scanner:allow-check-permissions",
"barcode-scanner:allow-request-permissions",
"barcode-scanner:allow-vibrate",
"core:app:allow-version",
"core:resources:default",
"core:app:default"
]
}

--- tauri "info"

[✔] Environment
- OS: Mac OS 14.5.0 arm64 (X64)
✔ Xcode Command Line Tools: installed
✔ rustc: 1.84.0 (9fc6b4312 2025-01-07)
✔ cargo: 1.84.0 (66221abde 2024-11-19)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: stable-aarch64-apple-darwin (default)
- node: 22.9.0
- pnpm: 8.15.5
- npm: 10.8.3

[-] Packages
- tauri 🦀: 2.2.3
- tauri-build 🦀: 2.0.5
- wry 🦀: 0.48.1
- tao 🦀: 0.31.1
- tauri-cli 🦀: 1.5.11
- @tauri-apps/api : 2.2.0
- @tauri-apps/cli : 2.2.5

[-] Plugins
- tauri-plugin-store 🦀: 2.2.0
- @tauri-apps/plugin-store : 2.2.0
- tauri-plugin-shell 🦀: 2.2.0
- @tauri-apps/plugin-shell : 2.2.0
- tauri-plugin-barcode-scanner 🦀: 2.2.0
- @tauri-apps/plugin-barcode-scanner : 2.2.0

[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: SolidJS
- bundler: Vite

@erskingardner
Copy link

+1 I'm also hitting this bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Android status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

7 participants