Tauri 2.0.0-alpha.4 Released
このコンテンツはまだ日本語訳がありません。
A new alpha release for the 2.0 has been published. This release includes all changes from the upcoming Tauri 1.3 release, an important breaking change on the HTTP client and native mobile capabilities for Tauri plugins.
Updating dependencies
Make sure to update both NPM and Cargo dependencies to the latest alpha release. You can update the NPM dependencies with:
npm install @tauri-apps/cli@next @tauri-apps/api@next
yarn upgrade @tauri-apps/cli@next @tauri-apps/api@next
pnpm update @tauri-apps/cli@next @tauri-apps/api@next
cargo add tauri@2.0.0-alpha.4cargo add tauri-build@2.0.0-alpha.2 --buildcargo install tauri-cli --version "^2.0.0-alpha" --locked
Recreate the mobile projects to use the new features:
rm -r src-tauri/gentauri android inittauri ios init
HTTP Client Breaking Change
The default HTTP client using attohttpc
has been removed due to issues with the development server proxy on Windows. All reqwest-*
feature flags have been removed because reqwest
is now the client we use.
Native Mobile Functionality for Tauri Plugins
A Tauri plugin now can access iOS via Swift and Android APIs via Kotlin or Java code, simplifying usage of platform interfaces such as camera or geolocation. To bootstrap the iOS and Android projects on an existing plugin, run tauri plugin ios add
and tauri plugin android add
. New plugins automatically include all the configuration needed to write native mobile code.
Here’s an example of a plugin that takes a string value and resolves an object:
Android plugin:
package com.plugin.example
import android.app.Activityimport app.tauri.annotation.Commandimport app.tauri.annotation.TauriPluginimport app.tauri.plugin.JSObjectimport app.tauri.plugin.Pluginimport app.tauri.plugin.Invoke
@TauriPluginclass ExamplePlugin(private val activity: Activity): Plugin(activity) { @Command fun ping(invoke: Invoke) { val value = invoke.getString("value") ?: "" val ret = JSObject() ret.put("value", value) invoke.resolve(ret) }}
iOS plugin:
import UIKitimport WebKitimport Tauri
class ExamplePlugin: Plugin { @objc public func ping(_ invoke: Invoke) throws { let value = invoke.getString("value") invoke.resolve(["value": value as Any]) }}
@_cdecl("init_plugin_example")func initPlugin(name: SRString, webview: WKWebView?) { Tauri.registerPlugin(webview: webview, name: name.toString(), plugin: ExamplePlugin())}
Rust code to initialize the plugin:
use tauri::{ plugin::{Builder, TauriPlugin}, Manager, Runtime,};
#[cfg(target_os = "ios")]tauri::ios_plugin_binding!(init_plugin_example);
pub fn init<R: Runtime>() -> TauriPlugin<R> { Builder::new("example") .setup(|app, api| { #[cfg(target_os = "android")] api.register_android_plugin("com.plugin.example", "ExamplePlugin")?; #[cfg(target_os = "ios")] api.register_ios_plugin(init_plugin_example)?; Ok(()) }) .build()}
Frontend code to call the plugin command:
import { invoke } from '@tauri-apps/api/tauri';invoke('plugin:example|ping', { value: 'Tauri' }).then(({ value }) => console.log('Response', value));
Check out the upcoming camera plugin and path plugin.
© 2025 Tauri Contributors. CC-BY / MIT