[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Getting started with Android Jetpack\n\nJetpack encompasses a collection of Android libraries that incorporate best\npractices and provide backwards compatibility in your Android apps.\n\nThe [Jetpack guide to app architecture](/jetpack/guide) provides an\noverview of the best practices and recommended architecture to consider as you\nbuild your Android app.\n\nThe following sections cover how you can get started using Jetpack components.\n| **Note:** Jetpack libraries don't send any user data to a backend service of any kind. This means that integrating a Jetpack library into your app has no impact on your app's [Data safety form](/guide/topics/data/collect-share) in the Play Console.\n\nUse a Jetpack library in your app\n---------------------------------\n\nAll Jetpack components are available on the [Google Maven repository](https://dl.google.com/dl/android/maven2/index.html).\n\nOpen the `settings.gradle` file add the `google()` repository in the\n`dependencyResolutionManagement { repositories {...}}` block as shown below: \n\n### Groovy\n\n```groovy\ndependencyResolutionManagement {\n repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n repositories {\n google()\n jcenter()\n }\n}\n```\n\n### Kotlin\n\n```kotlin\ndependencyResolutionManagement {\n repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n repositories {\n google()\n jcenter()\n }\n}\n```\n| **Warning:** The JCenter repository became read-only on March 31st, 2021. For more information, see [JCenter service update](/studio/build/jcenter-migration).\n\nYou can then add Jetpack components, such as architecture components like [LiveData](/topic/libraries/architecture/livedata)\nand [ViewModel](/topic/libraries/architecture/viewmodel), in your module's\n`build.gradle` file, as shown here: \n\n### Groovy\n\n```groovy\ndependencies {\n def lifecycle_version = \"2.2.0\"\n\n implementation \"androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version\"\n implementation \"androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version\"\n ...\n}\n```\n\n### Kotlin\n\n```kotlin\ndependencies {\n val lifecycle_version = \"2.2.0\"\n\n implementation(\"androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version\")\n implementation(\"androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version\")\n ...\n}\n```\n\nMany Jetpack libraries provide [Android KTX extensions](/kotlin/ktx) as shown above with `lifecycle-livedata-ktx` and `lifecycle-viewmodel-ktx`.\nThe KTX extensions build upon the Java-based API, taking advantage of Kotlin-specific language features.\n\nTo learn of new Jetpack library releases, check out the [Releases](/jetpack/androidx/releases) page.\n\n[Kotlin-based](/reference/kotlin/androidx/packages) and\n[Java-based](/reference/androidx/packages) API reference pages are available for\nall Jetpack libraries.\n\n### Verify Jetpack dependencies (optional)\n\n| **Note:** Signature verification is an opt-in feature for Gradle builds. If needed, you can [enable signature verification](https://docs.gradle.org/current/userguide/dependency_verification.html).\n\nAs of June 2023, the Jetpack team signs Jetpack libraries. These\nsignatures allow developers to verify that the library artifacts are built and\nsigned by Google. A library is eligible for signature verification once it\npublishes an update.\n| **Note:** Libraries released prior to June 2023 don't contain signatures and don't pass signature verification.\n\nIf your Android project has signature verification enabled, follow these steps\nto verify Jetpack dependencies in the Gradle project:\n\n1. Add Google's trusted keys to the `\u003ctrusted-keys\u003e` section in\n `$PROJECT_ROOT/gradle/verification-metadata.xml`:\n\n \u003ctrusted-keys\u003e\n \\\u003ctrusted-key id=\"8461efa0e74abae010de66994eb27db2a3b88b8b\"\\\u003e\n ...\n \\\u003c/trusted-key\\\u003e\n \\\u003ctrusted-key id=\"a5f483cd733a4ebaea378b2ae88979fb9b30acf2\"\\\u003e\n ...\n \\\u003c/trusted-key\\\u003e\n \\\u003ctrusted-key id=\"0f06ff86beeaf4e71866ee5232ee5355a6bc6e42\"\\\u003e\n ...\n \\\u003c/trusted-key\\\u003e\n \\\u003ctrusted-key id=\"0e225917414670f4442c250dfd533c07c264648f\"\\\u003e\n ...\n \\\u003c/trusted-key\\\u003e\n ...\n \u003c/trusted-keys\u003e\n\n2. Add a `\u003ctrusting group\u003e` entry for each library that the project is using.\n Here's an example for the `androidx.fragment` and `androidx.emoji2` libraries:\n\n \u003ctrusted-keys\u003e\n \u003ctrusted-key id=\"8461efa0e74abae010de66994eb27db2a3b88b8b\"\u003e\n \\\u003ctrusting group=\"androidx.fragment\"/\\\u003e\n \\\u003ctrusting group=\"androidx.emoji2\"/\\\u003e\n \u003c/trusted-key\u003e\n \u003ctrusted-key id=\"a5f483cd733a4ebaea378b2ae88979fb9b30acf2\"\u003e\n \\\u003ctrusting group=\"androidx.fragment\"/\\\u003e\n \\\u003ctrusting group=\"androidx.emoji2\"/\\\u003e\n \u003c/trusted-key\u003e\n ...\n \u003c/trusted-keys\u003e\n\nFor issues with dependency verification, visit Gradle's guide on\n[troubleshooting dependency verification](https://docs.gradle.org/current/userguide/dependency_verification.html#sub:enabling-verification).\n\nFinally, details on our trusted key can be viewed on\n[Ubuntu's keyserver site](https://keyserver.ubuntu.com/pks/lookup?search=0x8461efa0e74abae010de66994eb27db2a3b88b8b&fingerprint=on&op=index).\n\nTake advantage of Jetpack\n-------------------------\n\nJetpack libraries may be used alone or in combination to address different needs in your apps.\n\n- [WorkManager](/topic/libraries/architecture/workmanager) for your background scheduling needs.\n- [Room](/topic/libraries/architecture/room) for data storage persistence.\n- [Navigation](/guide/navigation/navigation-getting-started) to manage your application navigation flow.\n- [CameraX](/training/camerax) for your camera app needs.\n- See the [Overview](/jetpack/androidx/versions#version-table) of all the Jetpack libraries.\n\nJetpack libraries are published in the `androidx` namespace. If your project\ncurrently uses the Android Support Library, read how to [migrate to the\nandroidx namespace](/jetpack/androidx/migrate).\n\nTo learn more about using Jetpack, check out these pages:\n\n- [Android Architecture Components](/topic/libraries/architecture)\n- [Complete list of Jetpack components](/jetpack/androidx/explorer)\n\nAdditional resources\n--------------------\n\n### Online training\n\n- [Developing Android Apps with Kotlin](https://www.udacity.com/course/developing-android-apps-with-kotlin--ud9012) (Udacity course)\n\n### Sample code\n\n- The [Sunflower](https://github.com/android/sunflower) demo app uses many different Jetpack components to demonstrate Android development best practices.\n\n### Codelabs\n\n- [Android Lifecycles](https://codelabs.developers.google.com/codelabs/android-lifecycles/index.html)\n- [Room with a View](https://codelabs.developers.google.com/codelabs/android-room-with-a-view-kotlin)\n\n### Videos\n\n- [Assembling your Jetpack](https://youtu.be/2h-vuXC0SF8)"]]