Skip to content

Latest commit

 

History

History
97 lines (66 loc) · 2.05 KB

File metadata and controls

97 lines (66 loc) · 2.05 KB

androidx.lifecycle

This patch is built on the official androidx.lifecycle version 2.8.0 to support OpenHarmony platform.


Part 1: Quick Start

1. Add Maven Repository

Add the remote repository in your project's settings.gradle.kts:

dependencyResolutionManagement {
    repositories {
        maven {
            url = uri("https://mirrors.tencent.com/nexus/repository/maven-tencent/")
        }
    }
}

2. Add Dependencies

Add the following dependencies in your commonMain module's build.gradle.kts:

implementation("androidx.lifecycle:lifecycle-common:2.8.0-KBA-002")
implementation("androidx.lifecycle:lifecycle-runtime:2.8.0-KBA-002")
implementation("androidx.lifecycle:lifecycle-viewmodel:2.8.0-KBA-002")

Part 2: Build from Source

1. Clone AOSP Support Repository

Clone the Google AOSP support project:

git clone https://android.googlesource.com/platform/frameworks/support

Checkout the specific commit:

git checkout 7ad6b8bbf8fa3d5a3c97feca6c52a1a2bf98a622

2. Apply Patch

Download ov-androidx.lifecycle-2.8.0.patch and apply it:

git apply ov-androidx.lifecycle-2.8.0.patch

3. Configure Maven Repository

Add 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_password

Update the lifecycle version in libraryversions.toml:

LIFECYCLE=XXX

4. Publish

Requirements: JDK 21

Navigate to the project root and run:

cd playground-projects/lifecycle-playground
./gradlew publish --dependency-verification=off

After syncing, run the publishing gradle task in Android Studio to deploy the lifecycle artifacts.