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] tauri add doesn't add the conditional inclusion for desktop vs mobile #11737

Open
dionysuzx opened this issue Nov 19, 2024 · 0 comments
Open
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@dionysuzx
Copy link

If you follow the docs to add updater like cargo tauri add updater, it adds everything but you'll get this error: error[E0433]: failed to resolve: use of undeclared crate or module tauri_plugin_updater.

The reason for this is because in the Cargo.toml it will add tauri-plugin-updater conditionally excluding mobile builds:

[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-updater = "2.0.2"

Thus, the program cannot find tauri-plugin-updater when referenced in the lib.rs builder.

I fixed this by doing:

    let mut builder = tauri::Builder::default()
        .plugin(tauri_plugin_dialog::init())
        .plugin(tauri_plugin_fs::init())
        .plugin(tauri_plugin_os::init())
        .invoke_handler(tauri::generate_handler![
            ...
        ]);

    #[cfg(not(any(target_os = "android", target_os = "ios")))]
    {
        builder = builder.plugin(tauri_plugin_updater::Builder::new().build());
    }

One option is we can update the install script to also do this by default.

@FabianLars FabianLars transferred this issue from tauri-apps/plugins-workspace Nov 19, 2024
@FabianLars FabianLars added type: bug status: needs triage This issue needs to triage, applied to new issues labels Nov 19, 2024
@FabianLars FabianLars changed the title [bug] tauri-plugin-updater doesn't add the conditional inclusion for desktop vs mobile [bug] tauri add doesn't add the conditional inclusion for desktop vs mobile Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

2 participants