Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Aug 09 13:51:11 EEST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion hello-swift-library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The project consists of:

Before you can build and run this project, you need to have the following installed:

* **Java Development Kit (JDK)**: We recommend using JDK 21. Ensure the `JAVA_HOME` environment variable is set to your JDK installation path.
* **Java Development Kit (JDK)**: We recommend using JDK 25. Ensure the `JAVA_HOME` environment variable is set to your JDK installation path.
* **Swiftly**: You need to install [Swiftly](https://www.swift.org/install/)
* **Swift SDK for Android**: You need to install the [Swift SDK for Android](https://swift.org/install)

Expand Down
2 changes: 1 addition & 1 deletion hello-swift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The project consists of:

Before you can build and run this project, you need to have the following installed:

* **Java Development Kit (JDK)**: We recommend using JDK 21. Ensure the `JAVA_HOME` environment variable is set to your JDK installation path.
* **Java Development Kit (JDK)**: We recommend using JDK 25. Ensure the `JAVA_HOME` environment variable is set to your JDK installation path.
* **Swiftly**: You need to install [Swiftly](https://www.swift.org/install/)
* **Swift SDK for Android**: You need to install the [Swift SDK for Android](https://swift.org/install)

Expand Down
2 changes: 1 addition & 1 deletion native-activity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The project consists of:

Before you can build and run this project, you need to have the following installed:

* **Java Development Kit (JDK)**: We recommend using JDK 21. Ensure the `JAVA_HOME` environment variable is set to your JDK installation path.
* **Java Development Kit (JDK)**: We recommend using JDK 25. Ensure the `JAVA_HOME` environment variable is set to your JDK installation path.
* **Swiftly**: You need to install [Swiftly](https://www.swift.org/install/)
* **Swift SDK for Android**: You need to install the [Swift SDK for Android](https://swift.org/install)
* **Device/emulator with OpenGL ES support**
Expand Down
30 changes: 28 additions & 2 deletions swift-java-hashing-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,40 @@ The project is structured into two main parts:

Before you can build and run this project, you need to have the following installed:

* **Java Development Kit (JDK)**: We recommend using JDK 21. Ensure the `JAVA_HOME` environment variable is set to your JDK installation path.
* **Java Development Kit (JDK)**: This example requires the use of JDK 25. This is only necessary to locally publish the swift-java dependencies, and will not be required in the future. To simplify the build steps, we recommend installing JDK 25 and following all the steps below using the same JDK. Ensure the `JAVA_HOME` environment variable is set to your JDK installation path.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that I needed to have JAVA_HOME set at a system level (via zprofile) before launching android studio for the swiftpm invocation of swift-java to work. I assume this is expected since the JNI headers aren't found in the JBR installation at /Applications/Android Studio.app/Contents/jbr/Contents/Home ?

Other than that the instructions worked with JDK 25 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's follow up on this with future PR. Thanks!

* **Swiftly**: You need to install [Swiftly](https://www.swift.org/install/)
* **Swift SDK for Android**: You need to install the [Swift SDK for Android](https://swift.org/install)

## Setup and Configuration

### Prepare Swift Android SDK and matching Swift

Currently these examples utilize very recent nightly Swift Android SDK versions. In order to install these, you can use Swiftly (the Swift toolchain installer):

You can follow [these instructions](https://www.swift.org/documentation/articles/swift-sdk-for-android-getting-started.html) to install an appropriate Swift SDK for Android.

### Publish `swift-java` packages locally
As the `swift-java` project does not yet publish the neccessary Java packages needed at runtime, we need to do it ourself, by performing the following steps:
As the `swift-java` project does not yet publish the necessary Java packages needed at runtime, we need to do it ourselves, by performing the following steps:

> Note: This step will not be necessary once swift-java publishes releases.

In order to publish all artifacts from this library, you must use JDK 25, because some parts of swift-java are built for the most recent Java versions. You will not have to use JDK 25 for the rest of the development process.
A simple way to install and manage local Java installations is [sdkman](https://sdkman.io):

> Note: You will _not_ have to use most recent Java versions for your Android app, and the example currently targets Java language version 11.

Here's how to install `sdkman`:
```bash
curl -s "https://get.sdkman.io" | bash
```
Now restart the terminal so that the `sdk` utility is added to your path, and then set JDK 25 as your current Java install.

```bash
sdk install java 25.0.1-amzn --use # only in order to publish swift-java artifacts locally
export JAVA_HOME="${HOME}//.sdkman/candidates/java/current"
```

Next, let's prepare and publish the swift-java support libraries:

1. Enter the `hashing-lib` directory
```bash
Expand Down
5 changes: 2 additions & 3 deletions swift-java-hashing-example/hashing-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ android {
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

dependencies {
Expand Down