เวอร์ชันของไลบรารี
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ตั้งแต่เวอร์ชัน 15.0.0 เป็นต้นไป ห้องสมุดบริการ Google Play ได้รับการดูแลรักษาแยกกัน ซึ่งช่วยให้ทีมพัฒนาของแต่ละห้องสมุดสามารถส่งการแก้ไขและการปรับปรุงได้อย่างอิสระและรวดเร็วยิ่งขึ้น คุณติดตามรุ่นล่าสุดของบริการ Google Play และ Firebase ได้
การจับคู่เวอร์ชันแบบเข้มงวด
ไลบรารีเวอร์ชันหนึ่งอาจใช้ร่วมกับไลบรารีเวอร์ชันอื่นไม่ได้ เพื่อช่วยจัดการสถานการณ์นี้ พารามิเตอร์ของ Gradle หลายรายการมีคำแนะนำเกี่ยวกับเวอร์ชันที่ไม่ตรงกันเหล่านี้ ตรรกะในปลั๊กอินเหล่านี้จะคล้ายกับตรรกะในกฎ failOnVersionConflict()
สำหรับ ResolutionStrategy
ที่เชื่อมโยงกับบริการ Google Play และ Firebase Dependencies
ปลั๊กอินบริการของ Google
ปลั๊กอิน Gradle ของบริการ Google จะตรวจสอบบริการ Google Play และไลบรารี Firebase เวอร์ชันที่เข้ากันได้
ปลั๊กอินเครื่องมือจับคู่เวอร์ชันแบบสแตนด์อโลน
หากคุณไม่ได้ใช้ปลั๊กอินบริการของ Google แต่ยังคงต้องการการตรวจสอบเวอร์ชันอย่างเข้มงวดของไลบรารีที่ใช้ร่วมกัน ให้ใช้ [strict-version-matcher-plugin
] คุณสามารถดูโค้ดของปลั๊กอินนี้ได้ใน GitHub
ข้อมูลโค้ดต่อไปนี้แสดงวิธีเพิ่มปลั๊กอิน 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'
หากต้องการใช้ปลั๊กอินนี้ คุณจะต้องเพิ่มรายการต่อไปนี้ลงใน classpath ของ buildscript ซึ่งได้จากที่เก็บ Maven ของ 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'
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-04-15 UTC
[[["เข้าใจง่าย","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-04-15 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"]]