3 stable releases
new 2.0.2 | Apr 10, 2025 |
---|---|
2.0.1 | Apr 9, 2025 |
#421 in GUI
342 downloads per month
79KB
387 lines
Contains (JAR file, 44KB) gradle-wrapper.jar
Tauri Plugin android-package-install
Platform | Supported |
---|---|
Linux | x |
Windows | x |
macOS | x |
Android | ✓ |
iOS | x |
Install
This plugin requires a Rust version of at least 1.77.2
There are three general methods of installation that we can recommend.
- Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
- Pull sources directly from Github using git tags / revision hashes (most secure)
- Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
Install the Core plugin by adding the following to your Cargo.toml
file:
src-tauri/Cargo.toml
Manually
[target.'cfg(any(target_os = "android"))'.dependencies]
tauri-plugin-android-package-install = "2.0.1"
Automatically
use the cargo add
command to install it automatically (android target only):
cargo add tauri-plugin-android-package-install --target 'cfg(target_os = "android")'
Usage
First you need to register the core plugin with Tauri:
src-tauri/src/lib.rs
pub fn run() {
tauri::Builder::default()
.setup(|app| {
#[cfg(target_os = "android")]
app.handle().plugin(tauri_plugin_android_package_install::init())?;
Ok(())
})
.plugin(tauri_plugin_opener::init())
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
deno usage
import { checkPermissions, requestPermissions, install } from "jsr:@kingsword/tauri-plugin-android-package-install";
nodejs usage
- update .npmrc
+ @jsr:registry=https://npm.jsr.io
- install
npx jsr add @kingsword/tauri-plugin-android-package-install
- usage
import { checkPermissions, requestPermissions, install } from "@jsr/kingsword__tauri-plugin-android-package-install";
or
// package.json
{
"type": "module",
"dependencies": {
- "@jsr/kingsword__tauri-plugin-android-package-install": "2.0.1"
+ "@kingsword/tauri-plugin-android-package-install": "npm:@jsr/kingsword__tauri-plugin-android-package-install@2.0.1"
}
}
import { checkPermissions, requestPermissions, install } from "@kingsword/tauri-plugin-android-package-install";
QA
1. FileProvider Issue: Failed to find configured root that contains ...
res/xml/file_paths.xml
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="my_images" path="." />
<cache-path name="my_cache_images" path="." />
+ <files-path name="apk_files" path="." />
</paths>
Dependencies
~18–53MB
~852K SLoC