Skip to content

Commit 13b2ed4

Browse files
committed
Document what blocks an Android app archive
1 parent 86df59d commit 13b2ed4

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

Documentation/AndroidSwiftUIMigration.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,33 @@ device or emulator. Notable limitations, each documented in the source:
9494
`Sources/BluetoothExplorer/Skip/` (`ScanCallback.kt`, `BluetoothGattCallback.kt`) rehomed into the
9595
Android app project — they are peers for `AndroidBluetooth`, unrelated to Skip, and were only
9696
living in that directory because skipstone collected them.
97+
98+
## Building an Android app archive
99+
100+
CI (`.github/workflows/ci.yml`) archives the iOS app but does **not** produce an Android `.aab`.
101+
Three things block it, each verified by trying:
102+
103+
1. **The app does not cross-compile for Android.** `swift build --swift-sdk … --target BluetoothExplorer`
104+
fails inside `AndroidBluetooth`: its `@JavaImplementation` macro generates invalid Swift for
105+
`LowEnergyScanCallback.swiftOnScanFailed(error:)` — the parameter named `error` is emitted into a
106+
context where it parses as a keyword, producing
107+
`declaration name '…' is not covered by macro 'JavaImplementation'`. This is an upstream
108+
swift-java/AndroidBluetooth bug.
109+
2. **A whole-package Android build additionally fails in WasmKit's `SystemExtras`**: it does
110+
`st_mode & S_IFMT`, but `st_mode` is `UInt32` in the Android sysroot while swift-system's
111+
`CInterop.Mode` is `UInt16`. This target is not reachable from the app, so building specific
112+
targets avoids it; a plain `swift build` does not.
113+
3. **The Android project is still Skip's.** `Android/settings.gradle.kts` shells out to
114+
`skip plugin --prebuild`, and `Android/app/build.gradle.kts` applies `skip-build-plugin` with a
115+
`skip { }` block that reads the now-deleted `Skip.env`. With Skip removed none of that resolves.
116+
117+
Replacing (3) means writing a conventional Android app project, using
118+
[AndroidSwiftUI's `Demo/`](https://github.com/PureSwift/AndroidSwiftUI/tree/master/Demo) as the
119+
template: its `app/src/main/java/com/pureswift/swiftandroid/` Kotlin classes (`MainActivity`,
120+
`Application`, `NativeLibrary`, `ListViewAdapter`, `Fragment`, …) are the peers AndroidSwiftUI's
121+
`@JavaClass` bindings bind to, and `build-swift.sh` shows the packaging step — build the Swift
122+
package for the target architecture, then copy the resulting `.so` into
123+
`app/src/main/jniLibs/<abi>/`. The Kotlin JNI peers currently under `Sources/BluetoothExplorer/Skip/`
124+
(`ScanCallback.kt`, `BluetoothGattCallback.kt`) belong in that project too.
125+
126+
None of this is worth doing until (1) is fixed upstream, since the `.so` cannot be produced.

0 commit comments

Comments
 (0)