This patch is built on the official androidx.annotation version 1.8.0 to support OpenHarmony platform.
Add the remote repository in your project's settings.gradle.kts:
dependencyResolutionManagement {
repositories {
maven {
url = uri("https://mirrors.tencent.com/nexus/repository/maven-tencent/")
}
}
}Add the following dependency in your commonMain module's build.gradle.kts:
implementation("androidx.annotation:annotation:1.8.0-KBA-002")Clone the Google AOSP support project:
git clone https://android.googlesource.com/platform/frameworks/supportCheckout the specific commit:
git checkout 4e5e9e3ddec39fb6f9f34c89b1b4f9b58a1ab627Download ov-androidx.annotation-1.8.0.patch and apply it:
git apply ov-androidx.annotation-1.8.0.patchAdd remote maven repositories in buildSrc/repos.gradle:
handler.maven {
url = "https://mirrors.tencent.com/nexus/repository/maven-public"
}
handler.maven {
url = "https://mirrors.tencent.com/nexus/repository/maven-tencent"
}Configure maven publish settings in playground-common/androidx-shared.properties:
maven.remote.url=https://your-maven-repo-url
maven.remote.username=your_username
maven.remote.password=your_passwordUpdate the annotation version in libraryversions.toml:
ANNOTATION=1.8.0-KBA-002Requirements: JDK 21
Navigate to the project root and run:
cd playground-projects/collection-playground
./gradlew studioAfter syncing, run the publishing gradle task in Android Studio to deploy the annotation artifacts.