tauri-plugin-serialplugin-api 2.21.0 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +74 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -97,6 +97,46 @@ npm install tauri-plugin-serialplugin-api
97
97
  pnpm add tauri-plugin-serialplugin-api
98
98
  ```
99
99
 
100
+ ### Android Setup (Required for Android builds)
101
+
102
+ > **⚠️ Important:** If you're building for Android, you **must** configure the JitPack repository before building. The plugin will not compile without this step.
103
+
104
+ The plugin depends on `com.github.mik3y:usb-serial-for-android:3.8.1`, which is hosted on JitPack. Add the following to your `/src-tauri/gen/android/build.gradle.kts` file:
105
+
106
+ ```kotlin
107
+ buildscript {
108
+ repositories {
109
+ google()
110
+ mavenCentral()
111
+ maven { url = uri("https://jitpack.io") }
112
+ }
113
+ dependencies {
114
+ classpath("com.android.tools.build:gradle:8.11.0")
115
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.25")
116
+ // ... your other dependencies
117
+ }
118
+ }
119
+
120
+ allprojects {
121
+ repositories {
122
+ google()
123
+ mavenCentral()
124
+ maven { url = uri("https://jitpack.io") }
125
+ }
126
+ }
127
+
128
+ tasks.register("clean").configure {
129
+ delete("build")
130
+ }
131
+ ```
132
+
133
+ **Without this configuration, you will get an error:**
134
+ ```
135
+ could not find com.github.mik3y:usb-serial-for-android:3.8.1
136
+ ```
137
+
138
+ For more details and troubleshooting, see the [Android Setup](#android-setup) section.
139
+
100
140
  ---
101
141
 
102
142
  ## Basic Usage
@@ -1620,24 +1660,54 @@ await port.disableAutoReconnect();
1620
1660
 
1621
1661
  ## Android Setup
1622
1662
 
1623
- To use this plugin on Android, you need to add the JitPack repository to your project's `build.gradle.kts` file located at `/src-tauri/gen/android/build.gradle.kts`. Below is an example of how to configure it:
1663
+ To use this plugin on Android, you **must** add the JitPack repository to your project's `build.gradle.kts` file located at `/src-tauri/gen/android/build.gradle.kts`. This is required because the plugin depends on `com.github.mik3y:usb-serial-for-android:3.8.1`, which is hosted on JitPack.
1664
+
1665
+ ### Required Configuration
1666
+
1667
+ Add the JitPack repository to both `buildscript` and `allprojects` sections:
1624
1668
 
1625
1669
  ```kotlin
1626
1670
  buildscript {
1627
1671
  repositories {
1628
- // ...
1672
+ google()
1673
+ mavenCentral()
1629
1674
  maven { url = uri("https://jitpack.io") }
1630
1675
  }
1631
- // ...
1676
+ dependencies {
1677
+ classpath("com.android.tools.build:gradle:8.11.0")
1678
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.25")
1679
+ // ... your other dependencies
1680
+ }
1632
1681
  }
1633
1682
 
1634
1683
  allprojects {
1635
1684
  repositories {
1636
- // ...
1685
+ google()
1686
+ mavenCentral()
1637
1687
  maven { url = uri("https://jitpack.io") }
1638
1688
  }
1639
1689
  }
1690
+
1691
+ tasks.register("clean").configure {
1692
+ delete("build")
1693
+ }
1694
+ ```
1695
+
1696
+ ### Why is this needed?
1697
+
1698
+ The plugin uses the [usb-serial-for-android](https://github.com/mik3y/usb-serial-for-android) library, which is published on JitPack rather than Maven Central. Without adding JitPack to your repositories, Gradle will fail with an error like:
1699
+
1640
1700
  ```
1701
+ could not find com.github.mik3y:usb-serial-for-android:3.8.1
1702
+ ```
1703
+
1704
+ ### Troubleshooting
1705
+
1706
+ If you still encounter issues after adding JitPack:
1707
+
1708
+ 1. Make sure you've added it to **both** `buildscript.repositories` and `allprojects.repositories`
1709
+ 2. Sync your Gradle files in your IDE
1710
+ 3. Clean and rebuild your project: `./gradlew clean build`
1641
1711
 
1642
1712
  ---
1643
1713
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tauri-plugin-serialplugin-api",
3
- "version": "2.21.0",
3
+ "version": "2.22.0",
4
4
  "license": "MIT or APACHE-2.0",
5
5
  "type": "module",
6
6
  "types": "./dist-js/index.d.ts",