เวอร์ชันของไลบรารี
ตั้งแต่เวอร์ชัน 15.0.0 ไลบรารีของบริการ Google Play มีการบำรุงรักษา
แยกเป็นรายๆ ไป ซึ่งช่วยให้ทีมพัฒนาห้องสมุดแต่ละแห่งสามารถจัดส่งการแก้ไขได้
และการปรับปรุงได้อย่างอิสระ
และรวดเร็วยิ่งขึ้น คุณสามารถติดตาม
รุ่นสำหรับบริการ Google Play และ
Firebase
การจับคู่เวอร์ชันแบบเข้มงวด
เวอร์ชันของไลบรารีหนึ่งอาจไม่สามารถใช้ร่วมกับเวอร์ชันที่เจาะจงของ
ไลบรารีอื่น เพื่อช่วยรับมือกับสถานการณ์นี้ ปลั๊กอิน Gradle หลายตัวมี
เกี่ยวกับเวอร์ชันที่ไม่ตรงกัน ตรรกะในปลั๊กอินเหล่านี้คือ
ซึ่งคล้ายกับตรรกะในกฎ failOnVersionConflict()
ResolutionStrategy
ที่เชื่อมโยงกับบริการ Google Play และทรัพยากร Dependency ของ Firebase
ปลั๊กอินบริการของ Google
ปลั๊กอิน Google Services Gradle
ตรวจหาเวอร์ชันที่เข้ากันได้ของบริการ Google Play และไลบรารี Firebase
ปลั๊กอินตัวจับคู่เวอร์ชันสแตนด์อโลน
ถ้าคุณไม่ได้ใช้ปลั๊กอิน Google Services แต่คุณต้องการการปกป้องที่เข้มงวด
การตรวจสอบเวอร์ชันของทรัพยากร Dependency คุณสามารถใช้
[strict-version-matcher-plugin
]. คุณดูปลั๊กอินนี้ได้
ใน GitHub
ข้อมูลโค้ดต่อไปนี้แสดงวิธีเพิ่มปลั๊กอิน Gradle
Kotlin DSL
build.gradle.kts
plugin {
id("com.google.android.gms.strict-version-matcher-plugin")
}
DSL กรูฟฟี่
build.gradle
apply plugin: 'com.google.android.gms.strict-version-matcher-plugin'
ในการใช้ปลั๊กอินนี้ คุณต้องเพิ่มสิ่งต่อไปนี้ลงใน
Buildscript classpath ที่ได้รับจาก Maven ของ Google
ที่เก็บงานใหม่:
Kotlin DSL
build.gradle.kts
classpath("com.google.android.gms:strict-version-matcher-plugin:1.2.4")
DSL กรูฟฟี่
build.gradle
classpath 'com.google.android.gms:strict-version-matcher-plugin:1.2.4'
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-09-11 UTC
[null,null,["อัปเดตล่าสุด 2024-09-11 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"]]