navigation
Dependencies {def activity_version = "1.2.0-rc01" // Java language implementation implementation "androidx.activity:activity:$activity_version" // Kotlin implementation "Androidx. Activity: activity - KTX: $activity_version" implementation "androidx. Fragments: fragments: 1.3.0 - rc01" implementation "Androidx. Fragments: fragments - KTX: 1.3.0 - rc01"}Copy the code
The previous startActivityForResult Api was abandoned in favor of the ActivityResult Api after version 1.2
Dependencies {def nav_version = "2.3.2" // Java language implementation implementation "androidx.navigation:navigation-fragment:$nav_version" implementation "androidx.navigation:navigation-ui:$nav_version" // Kotlin implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" // Feature module Support implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version" // Testing Navigation androidTestImplementation "androidx.navigation:navigation-testing:$nav_version" // Jetpack Compose Integration implementation "Androidx. Navigation: navigation - compose: 1.0.0 - alpha04"}Copy the code
Biometrics and identification
Dependencies {/ / Java language implementation implementation "androidx. Biometric: biometric:" 1.0.1 / / Kotlin Implementation "androidx. Biometric: biometric: 1.2.0 - alpha01"}Copy the code
Since not all devices will have biometric hardware, different analysis is required. The document
The camera
Camera to document
Dependencies {// CameraX core library using the camera2 implementation def camerax_version = "1.0.0-rc01" // the following line is optional, as the core library is included indirectly by camera-camera2 implementation "androidx.camera:camera-core:${camerax_version}" implementation "androidx.camera:camera-camera2:${camerax_version}" // If you want to additionally use the CameraX Lifecycle library implementation "androidx.camera:camera-lifecycle:${camerax_version}" // If you want to additionally use the CameraX View class Implementation "Androidx. camera: Camera-view :1.0.0-alpha20" // If you want to additionally use the CameraX Extensions Library implementation "androidx. Camera: the camera - extensions: 1.0.0 - alpha20"}Copy the code
Some rely on
Implementation "androidx cardview: cardview: 1.0.0" implementation "androidx. Constraintlayout: constraintlayout: 2.0.0." " Implementation "androidx coordinatorlayout: coordinatorlayout: 1.1.0" implementation "Androidx. Drawerlayout: drawerlayout: 1.1.1" API "androidx. Multidex: multidex: 2.0.1" kapt 'androidx. Annotation: the annotation: 1.2.0' API "com. Google. Android. Material: material: 1.3.0" / / animation difference, implementation "Androidx. Interpolator: interpolator: 1.0.0" / / app startup implementation "androidx. Startup: startup - runtime: 1.0.0" // If you are a library developer and use ContentProvider to initialize your library, you should use App Startup to reduce Startup time for your library App. // Read and write the image file EXIF tag. Implementation "androidx exifinterface: exifinterface: 1.3.2" implementation / / view file documents "Androidx. Documentfile: documentfile:" 1.0.1 / / dropdown refresh implementation "androidx. Swiperefreshlayout: swiperefreshlayout: 1.1.0." " / / viewpager2 implementation "androidx viewpager2: viewpager2:1.0.0" / / compatible with Windows, Aiming at the folding screen implementation "androidx window: window: 1.0.0 - alpha01" / / web implementation "androidx. Its: its: 1.4.0" / / slide window Implementation "androidx slidingpanelayout: slidingpanelayout: 1.1.0" dependencies {implementation "Androidx. Recyclerview: recyclerview: 1.1.0" / / For the control over the item selection of both the touch and mouse driven selection Implementation "androidx recyclerview: recyclerview - selection: 1.1.0 - rc03"} / / reduce the effects of existing and new small collections of memory. Dependencies {def collection_version = "1.1.0" // Java language implementation implementation "androidx.collection:collection:$collection_version" // Kotlin implementation "Androidx. Collection: collection - KTX: $collection_version"} dependencies {def core_version = "1.3.2" / / Java language implementation implementation "androidx.core:core:$core_version" // Kotlin implementation "Androidx. core:core-ktx:$core_version" // To use RoleManagerCompat implementation" Androidx. core:core-role:1.0.0-rc01" Core :core-animation:1.0.0-alpha02" // To test the Animator APIs AndroidTestImplementation "androidx. Core: the core - animation - testing: 1.0.0 - alpha02"} dependencies {def fragment_version = "1.2.5" / / Java language implementation implementation "androidx. Fragments: fragments: $fragment_version" / / Kotlin implementation "androidx.fragment:fragment-ktx:$fragment_version" // Testing Fragments in Isolation debugImplementation "androidx.fragment:fragment-testing:$fragment_version" }Copy the code
DataStore
The typed
// Typed DataStore (Typed API surface, To the as Proto) dependencies {implementation "androidx datastore: datastore: 1.0.0 - alpha05"} / / Alternatively - use the following artifact without an Android dependency. dependencies { implementation "Androidx. Datastore: datastore - core: 1.0.0 - alpha05"}Copy the code
Preference setting
// Preferences DataStore (SharedPreferences like APIs) dependencies { implementation "Androidx. Datastore: datastore - preferences: 1.0.0 - alpha05"} / / Alternatively - use the following an artifact with the an Android dependency. Dependencies {implementation "androidx datastore: datastore - preferences - core: 1.0.0 - alpha05"}Copy the code
The document
Make smooth animations using physics
Dependencies {/ / Java language implementation implementation "androidx. Dynamicanimation: dynamicanimation: 1.0.0" / / Kotlin implementation "androidx dynamicanimation: dynamicanimation - KTX: 1.0.0 - alpha03"}Copy the code
lifeCycle
Dependencies {def lifecycle_version = "2.2.0" def arch_version = "2.1.0 "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" // LiveData implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" // Lifecycles only (without ViewModel or LiveData) implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" // Saved state module for ViewModel implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version" // Annotation processor kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version" // alternately - if using Java8, use the following instead of lifecycle-compiler implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" // optional - helpers for implementing LifecycleOwner in a Service implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version" // optional - ProcessLifecycleOwner provides a lifecycle for the whole application process implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version" // optional - ReactiveStreams support for LiveData implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version" // optional - Test helpers for LiveData testImplementation "androidx.arch.core:core-testing:$arch_version" }Copy the code
loader
The document
Dependencies {implementation "androidx loader, loader: 1.1.0"}Copy the code
Media2
There is no official document to share media content and controls with other applications.
Dependencies {def media2_version = "2.1.1" // Medium sessions implementation "androidx.media2:media2-session:$media2_version" // optional - UI widgets for VideoView and MediaControlView implementation "androidx.media2:media2-widget:$media2_version" // optional - Implementation of a SessionPlayer implementation "androidx.media2:media2-player:$media2_version" }Copy the code
Mediarouter
Using a universal interface to display and play media content on remote receiver devices.
Dependencies {implementation "androidx mediarouter: mediarouter: 1.2.0"}Copy the code
paging 3
The document
Dependencies {def paging_version = "3.0.0-alpha11" implementation "androidx.paging: Paging - Runtime :$paging_version alternatively - without Android dependencies for tests testImplementation "androidx.paging:paging-common:$paging_version" // optional - RxJava2 support implementation "androidx.paging:paging-rxjava2:$paging_version" // optional - RxJava3 support implementation "androidx.paging:paging-rxjava3:$paging_version" // optional - Guava ListenableFuture support implementation "androidx.paging:paging-guava:$paging_version" // Jetpack Compose Integration implementation "Androidx. The paging: the paging - compose: 1.0.0 - alpha04"}Copy the code
room
Dependencies {def room_version = "2.2.5" implementation "androidx :room-runtime:$room_version "androidx.room:room-compiler:$room_version" // optional - Kotlin Extensions and Coroutines support for Room implementation "androidx.room:room-ktx:$room_version" // optional - Test helpers testImplementation "androidx.room:room-testing:$room_version" }Copy the code
sqlist
Dependencies {def sqlite_version = "Java language implementation implementation "androidx.sqlite:sqlite:$sqlite_version" // Kotlin implementation "androidx.sqlite:sqlite-ktx:$sqlite_version" // Implementation of the AndroidX SQLite interfaces via the Android framework APIs. implementation "androidx.sqlite:sqlite-framework:$sqlite_version" }Copy the code
Vectordrawable
Render vector ICONS
Dependencies {implementation "androidx vectordrawable: vectordrawable: 1.1.0" / * To be able To animate the properties of a VectorDrawable, add the following. Useful for * illustration purposes or state changes in response to user events */ implementation "Androidx. Vectordrawable: vectordrawable - animated: 1.1.0" / * To use a seekable the alternative for `androidx.vectordrawable:vectordrawable-animated` add the * following */ implementation "Androidx. Vectordrawable: vectordrawable - seekable: 1.0.0 - alpha02"}Copy the code
work
Implementation "androidx. Work :work-runtime:$work_version" // Kotlin + coroutines implementation "androidx.work:work-runtime-ktx:$work_version" // optional - RxJava2 support implementation "androidx.work:work-rxjava2:$work_version" // optional - GCMNetworkManager support implementation "androidx.work:work-gcm:$work_version" // optional - Test helpers androidTestImplementation "androidx.work:work-testing:$work_version" }Copy the code
hilt
Dependencies {API "androidx. Hilt :hilt-lifecycle viewModel :1.0.0-alpha03 When using kotlin.kapt 'androidx.hilt: Hilt-compiler :1.0.0-alpha03' API "com.google.dagger:hilt-android:2.28-alpha" Kapt com. Google. "dagger hilt - android - the compiler: 2.28 - alpha"}Copy the code
Note: Some dependencies may include both Java and Kotlin (marked with Java Only), please use them according to the language environment.