Phiên bản thư viện
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Kể từ phiên bản 15.0.0, các thư viện Dịch vụ Google Play được duy trì riêng lẻ, cho phép các nhóm phát triển của từng thư viện phân phối các bản sửa lỗi và tính năng nâng cao một cách độc lập và nhanh chóng hơn. Bạn có thể theo dõi các bản phát hành mới nhất cho Dịch vụ Google Play và Firebase.
So khớp phiên bản nghiêm ngặt
Một phiên bản của thư viện này có thể không tương thích với một phiên bản cụ thể của thư viện khác. Để giúp xử lý trường hợp này, một số trình bổ trợ Gradle cung cấp hướng dẫn về các trường hợp không khớp phiên bản này. Logic trong các trình bổ trợ này tương tự như logic trong quy tắc failOnVersionConflict()
cho ResolutionStrategy
liên kết với các dịch vụ của Google Play và các phần phụ thuộc Firebase.
Trình bổ trợ Dịch vụ của Google
Trình bổ trợ Gradle cho Dịch vụ của Google sẽ kiểm tra các phiên bản tương thích của Dịch vụ Google Play và thư viện Firebase.
Trình bổ trợ so khớp phiên bản độc lập
Nếu không sử dụng trình bổ trợ Dịch vụ của Google nhưng vẫn muốn kiểm tra phiên bản nghiêm ngặt đối với các phần phụ thuộc, bạn có thể áp dụng [strict-version-matcher-plugin
]. Bạn có thể xem mã của trình bổ trợ này trên GitHub.
Đoạn mã sau đây cho biết cách thêm trình bổ trợ Gradle:
Kotlin DSL
build.gradle.kts
plugin {
id("com.google.android.gms.strict-version-matcher-plugin")
}
Groovy DSL
build.gradle
apply plugin: 'com.google.android.gms.strict-version-matcher-plugin'
Để sử dụng trình bổ trợ này, bạn cũng cần thêm nội dung sau vào đường dẫn lớp buildscript, lấy từ kho lưu trữ Maven của Google:
Kotlin DSL
build.gradle.kts
classpath("com.google.android.gms:strict-version-matcher-plugin:1.2.4")
Groovy DSL
build.gradle
classpath 'com.google.android.gms:strict-version-matcher-plugin:1.2.4'
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-03-21 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-03-21 UTC."],[[["Google Play services libraries are now individually maintained, allowing for faster and more frequent updates to individual components."],["Strict version matching is crucial as library versions might be incompatible, and the Google Services Gradle plugin and the standalone strict-version-matcher-plugin help manage these dependencies."],["The `strict-version-matcher-plugin` offers a way to ensure version compatibility for Google Play services and Firebase dependencies, even without using the Google Services plugin."],["To utilize the standalone plugin, you need to add it to your buildscript classpath and apply it in your Gradle file using the provided code snippets."]]],["Google Play services libraries are individually maintained, enabling faster updates. To manage potential version incompatibilities between libraries, Gradle plugins provide guidance. The Google Services Gradle plugin checks for compatible versions of Google Play services and Firebase libraries. Alternatively, the `strict-version-matcher-plugin` offers dependency version checking without the Google Services plugin. To use it you must add the plugin and the `strict-version-matcher-plugin` classpath to your build script.\n"]]