Google Play Core Library 總覽

本資訊頁面說明 Google Play Core Library,以及如何將這些程式庫新增至專案。

Google Play Core Library 是應用程式與 Google Play 商店之間的執行階段介面。您可以採取下列幾項行動:

Play Core Library 提供 Java原生Unity 版本。如要進一步瞭解最新版本,請參閱版本資訊

從 Play Core Java 和 Kotlin 程式庫遷移

Play Core Java 和 Kotlin 程式庫已分割為多個提供個別功能的 Android 程式庫。這麼做可縮減 Play Core Library 加入應用程式的大小,並縮短個別功能的發布週期。

在這項遷移作業中,各項功能的行為皆保持一致,唯一的差別在於新版採用了 Google Play 服務的 Task API

請使用下方清單遷移至新的程式庫,獲取新功能和錯誤修正帶來的優勢。如果您要使用多項 Play 功能,則可以直接在 build.gradle 檔案中一次匯入多個程式庫。

常見的遷移步驟

  1. 將 Task 物件的任何現有匯入陳述式從 import com.google.android.play.core.tasks.*; 更新為 import com.google.android.gms.tasks.*;。所有類別名稱皆維持不變。
  2. 移除 build.gradle 檔案中所有的舊版 Play Core Library 匯入作業。

整合 Play Asset Delivery 程式庫

Groovy

// In your app’s build.gradle file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // So, make sure you also include that repository in your project's build.gradle file.
    implementation 'com.google.android.play:asset-delivery:2.2.2'

    // For Kotlin users also add the Kotlin extensions library for Play Asset Delivery:
    implementation 'com.google.android.play:asset-delivery-ktx:2.2.2'
    ...
}

Kotlin

// In your app’s build.gradle.kts file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // So, make sure you also include that repository in your project's build.gradle file.
    implementation("com.google.android.play:asset-delivery:2.2.2")

    // For Kotlin users also import the Kotlin extensions library for Play Asset Delivery:
    implementation("com.google.android.play:asset-delivery-ktx:2.2.2")
    ...
}

整合 Play Feature Delivery 程式庫

Groovy

// In your app’s build.gradle file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // So, make sure you also include that repository in your project's build.gradle file.
    implementation 'com.google.android.play:feature-delivery:2.1.0'

    // For Kotlin users, also add the Kotlin extensions library for Play Feature Delivery:
    implementation 'com.google.android.play:feature-delivery-ktx:2.1.0'
    ...
}

Kotlin

// In your app’s build.gradle.kts file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // Make sure you also include that repository in your project's build.gradle file.
    implementation("com.google.android.play:feature-delivery:2.1.0")

    // For Kotlin users, also import the Kotlin extensions library for Play Feature Delivery:
    implementation("com.google.android.play:feature-delivery-ktx:2.1.0")
    ...
}

整合 Play 應用程式內評論程式庫

Groovy

// In your app’s build.gradle file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // Make sure you also include that repository in your project's build.gradle file.
    implementation 'com.google.android.play:review:2.0.1'

    // For Kotlin users, also add the Kotlin extensions library for Play In-App Review:
    implementation 'com.google.android.play:review-ktx:2.0.1'
    ...
}

Kotlin

// In your app’s build.gradle.kts file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // Make sure you also include that repository in your project's build.gradle file.
    implementation("com.google.android.play:review:2.0.1")

    // For Kotlin users, also import the Kotlin extensions library for Play In-App Review:
    implementation("com.google.android.play:review-ktx:2.0.1")
    ...
}

整合 Play 應用程式內更新程式庫

Groovy

// In your app’s build.gradle file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // Make sure you also include that repository in your project's build.gradle file.
    implementation 'com.google.android.play:app-update:2.1.0'

    // For Kotlin users, also add the Kotlin extensions library for Play In-App Update:
    implementation 'com.google.android.play:app-update-ktx:2.1.0'
    ...
}

Kotlin

// In your app’s build.gradle.kts file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // Make sure you also include that repository in your project's build.gradle file.
    implementation("com.google.android.play:app-update:2.1.0")

    // For Kotlin users, also import the Kotlin extensions library for Play In-App Update:
    implementation("com.google.android.play:app-update-ktx:2.1.0")
    ...
}

Play Core 軟體開發套件服務條款

    上次修改時間:2020 年 9 月 24 日
  1. 使用 Play Core 軟體開發套件,即表示您同意遵守本條款,以及《Google API 服務條款》(以下簡稱「API 服務條款」)。如果本條款與 API 服務條款相牴觸,應以本條款為準。請詳閱本條款和 API 服務條款。
  2. 就本條款而言,「API」是指 Google 的 API、其他開發人員服務和相關軟體,包括任何可轉散發程式碼。
  3. 「可轉散發程式碼」是指 Google 提供的物件程式碼或標頭檔案,用於呼叫 API。
  4. 根據本條款和 API 服務條款的規定,您可以複製並發布可轉散發程式碼,但只能納入為 API 用戶端的一部分。Google 及其授權人對「可轉散發的程式碼」擁有所有權利、所有權和利益,包括任何和所有智慧財產權及其他專有權利。您不得對可轉散發程式碼進行修改、翻譯或製造衍生作品。
  5. Google 可隨時變更本條款。條款有所異動時,Google 會發出通知並提供選項,讓開發人員可以拒絕繼續使用 Play Core 軟體開發套件。Google 會在 https://developer.android.com/guide/playcore/license 發布條款修訂通知。變更不溯及既往。