Google Mobile Ads Lite SDK
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เช่นเดียวกับไลบรารี Android อื่นๆ SDK ของบริการ Google Play จะเพิ่มขนาดของ
แอปที่รวม SDK นี้ Google Mobile Ads Lite SDK เป็นเวอร์ชันที่มีขนาดเล็ก
ของ Google Mobile Ads SDK ซึ่งสร้างขึ้นเพื่อลดผลกระทบดังกล่าว ซึ่งมีขนาดเล็กกว่า SDK ปกติ
นอกเหนือจากขนาดที่ลดลงแล้ว การใช้ Lite SDK ยังช่วยลดจำนวนทั้งหมดของ
เมธอดที่อ้างอิงในแอปด้วย ซึ่งจะเป็นประโยชน์อย่างยิ่งเมื่อติดตั้งใช้งานใน Android เวอร์ชันเก่า
ซึ่งนักพัฒนาแอปอาจพบขีดจำกัดการอ้างอิง 64K
วิธีกำหนดค่า Gradle เพื่อรวม Lite SDK เข้ากับแอปมีดังนี้
dependencies {
implementation 'com.google.android.gms:play-services-ads-lite:24.3.0'
}
ข้อจำกัดของ Lite SDK
ควรใช้ Lite SDK ในแอปที่เผยแพร่ผ่าน Google Play Store เท่านั้น
การติดตั้งใช้งาน Google Mobile Ads SDK มาตรฐานใน APK ของบริการ Google Play จะรวมอยู่ในไลบรารีไคลเอ็นต์ของบริการ Google Play ด้วย ซึ่งแตกต่างจากบริการ Google Play อื่นๆ
ซึ่งจะช่วยให้รองรับ
อุปกรณ์ที่ไม่มี APK ของบริการ Google Play ได้ เมื่อรันไทม์ SDK จะเปรียบเทียบ
เวอร์ชันของไลบรารีไคลเอ็นต์และ APK ของบริการ Google Play แล้วใช้
เวอร์ชันที่ใหม่กว่า
Lite SDK จะนำการติดตั้งใช้งาน Google Mobile Ads SDK ออกจากไลบรารีไคลเอ็นต์
โดยเหลือไว้เพียงอินเทอร์เฟซไปยัง APK ของบริการ Google Play SDK Lite
ต้องอาศัยการติดตั้งใช้งาน APK หากคุณติดตั้งใช้งานแอปนอก Google Play Store เราไม่รับประกันว่าอุปกรณ์ของผู้ใช้จะติดตั้ง APK ของ Google Play Services
ในอุปกรณ์ที่ใช้บริการ Google Play เวอร์ชันล่าสุด ลักษณะการทำงานของ Lite SDK
จะเหมือนกับ SDK มาตรฐาน อย่างไรก็ตาม ในอุปกรณ์ที่บริการ Google Play เป็นเวอร์ชันเก่าหรือไม่มีอยู่ SDK Lite อาจอ้างอิง API ที่ไม่พร้อมใช้งานหรือมีการเปลี่ยนแปลงจาก API ใน APK ของบริการ Google Play ซึ่งจะส่งผลให้ไม่มีการดำเนินการใดๆ และมีการบันทึกข้อผิดพลาด ซึ่งอาจ
ทำให้โฆษณาไม่แสดงในอุปกรณ์เหล่านั้น
ความถี่ในการเผยแพร่ Lite SDK
ตั้งแต่เวอร์ชัน 24.1.0 เป็นต้นไป play-services-ads-lite
อาร์ติแฟกต์จะหยุดเผยแพร่ตามจังหวะเดียวกับ play-services-ads
การเปลี่ยนแปลงนี้ช่วยให้การเปิดตัวการติดตั้งใช้งาน SDK เป็นไปอย่างค่อยเป็นค่อยไปและเสถียรมากขึ้น
SDK แบบ Lite จะเผยแพร่ทุกๆ 3 ครั้งของการเผยแพร่ SDK โดยประมาณ
โปรเจ็กต์ที่ขึ้นอยู่กับทั้ง play-services-ads-lite
เวอร์ชัน 24.0.0 หรือต่ำกว่า
และ play-services-ads
เวอร์ชัน 24.1.0 ขึ้นไปจะพบDuplicate class
ข้อผิดพลาดระหว่างการคอมไพล์แอป แก้ไขข้อผิดพลาดนี้โดยใช้เฉพาะอาร์ติแฟกต์ play-services-ads
หรือ play-services-ads-lite
อย่างใดอย่างหนึ่งเท่านั้น
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-09-05 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-09-05 UTC"],[[["\u003cp\u003eThe Google Mobile Ads Lite SDK is a smaller version of the Google Mobile Ads SDK, designed to reduce app size and method references.\u003c/p\u003e\n"],["\u003cp\u003eIt is ideal for older Android versions, helping avoid the 64K reference limit.\u003c/p\u003e\n"],["\u003cp\u003eThe Lite SDK is exclusively for apps distributed via the Google Play Store and relies on the Google Play services APK on user devices.\u003c/p\u003e\n"],["\u003cp\u003eWhile functionally similar to the standard SDK on updated devices, the Lite SDK may encounter issues on devices with outdated or missing Google Play services, potentially impacting ad serving.\u003c/p\u003e\n"]]],["The Google Mobile Ads Lite SDK reduces app size and the number of referenced methods compared to the standard SDK, aiding developers targeting older Android versions. To implement it, add the specified dependency to the app's Gradle file. This SDK should only be used for apps distributed via the Google Play Store, as it relies on the Google Play services APK for functionality. On devices lacking or with outdated Google Play services, it might result in errors and ads not serving.\n"],null,["Like any Android library, the Google Play services SDK increases the size of\napps that include it. The Google Mobile Ads Lite SDK is a lightweight version\nof Google Mobile Ads SDK built to reduce that impact. It is a fraction of\nthe size of the regular SDK.\n\nAlongside reduced size, using the Lite SDK decreases the total number of\nmethods referenced in an app. This is especially useful when deploying to older\nversions of Android, where developers can run into the [64K reference\nlimit](//developer.android.com/studio/build/multidex).\n\nHere's how to configure gradle to incorporate the Lite SDK into your app: \n\n dependencies {\n implementation 'com.google.android.gms:play-services-ads-lite:24.3.0'\n }\n\nLimitations of the Lite SDK\n\nThe Lite SDK should only be used in apps distributed through the\nGoogle Play store.\n\nUnlike other [Google Play services](/android/guides/overview), the standard\nGoogle Mobile Ads SDK implementation in the Google Play services APK is also\nincluded in the Google Play services client library. This allows for support on\ndevices without the Google Play services APK. At runtime, the SDK will compare\nthe versions of the client library and the Google Play services APK and use the\nnewer version.\n\nThe Lite SDK strips Google Mobile Ads SDK implementation from the client\nlibrary, leaving only an interface to the Google Play services APK. The Lite\nSDK relies on the implementation of the APK. If you deploy your app outside of\nthe Google Play store, it is not guaranteed that your user's devices will have\nthe Google Play services APK installed.\n\nOn devices with an up-to-date version of Google Play services, the Lite SDK's\nbehavior is identical to that of the standard SDK. However, on devices where\nGoogle Play services is outdated or not present, the Lite SDK may reference\nAPIs that are unavailable or have been changed from those in the Google Play\nservices APK. This will result in a no-op and an error being logged, which may\ncause ads not to serve to those devices.\n\nLite SDK release cadence\n\nStarting with version 24.1.0, the `play-services-ads-lite`\nartifact stops releasing at the same cadence as `play-services-ads`. This\nchange allows for a more gradual and stable rollout of the SDK implementation.\nThe Lite SDK releases approximately every third SDK release.\n\nProjects that depend on both `play-services-ads-lite` version 24.0.0 or lower\nand `play-services-ads` version 24.1.0 or higher encounter a `Duplicate class`\nerror during app compilation. Resolve this error by using only one of the\n`play-services-ads` or `play-services-ads-lite` artifacts."]]