ドキュメント

​
​

Development

User Acquisition

Monetization

産業

In-App Purchasing

IAP Client API

IAP SDK API

Webshop Admin API

Webshop Client API

In-App Purchasing

このページは選択した言語では使用できません。
LiveOps
​
​
Get started
  • Overview
  • Introduction to IAP
  • What's new in IAP v5.4
  • Upgrade from IAP v4 to v5
    • Troubleshooting IAP 5.4.0 on Unity 2022.3
  • AI skill for In-App Purchasing
Direct to Consumer (D2C) payments
  • Direct to Consumer (D2C) payment providers
Webshop
  • Overview
  • Get started with webshops
  • Webshop setup
  • Catalog and payments
  • Game integration for webshops
  • Troubleshooting webshops
Platform-native stores
  • Set up IAP for platform-native stores
  • Codeless IAP
Catalogs and store management
  • Create product catalogs
  • Supported stores
Purchases
  • Purchase management and fulfillment
Monitor IAP performance
  • Overview
  • IAP revenue performance
  • D2C performance
Privacy
  • Privacy and consent
  1. Unity アプリ内課金

Troubleshooting In-App Purchasing 5.4.0 Android builds on Unity 2022.3

Solve an Android build failure when you use In-App Purchasing 5.4.0 on Unity 2022.3 LTS.
読み終わるまでの所要時間 4 分
最終更新 2ヶ月前

In-App Purchasing (IAP) 5.4.0 is designed for Unity 6. To use IAP 5.4.0 with Unity 2022.3 LTS on Android, you need to adjust some project settings.
This page explains why the build fails on Unity 2022.3, how to recognize the errors, and the steps to build successfully. The steps are verified against Unity 2022.3.62f2, but they apply to Unity 2022.3 LTS in general.
注
For new projects, and to avoid this configuration entirely, use Unity 6, where IAP 5.4.0 builds without changes. If you're staying on Unity 2022.3 for now, you can use this page to adopt IAP 5.4.0 today, and then you can plan a move to Unity 6 at your own pace.

Symptoms

Depending on your build settings, IAP 5.4.0 on Unity 2022.3 can fail during the Android build with one or more of the following errors. If you get these errors, apply the steps in the Resolution section.
  • A manifest merge error such as
    uses-sdk:minSdkVersion 22 cannot be smaller than version 23 declared in library [com.android.billingclient:billing:9.0.0]
    .
  • An R8 error during the minify step, for example
    R8: java.lang.NullPointerException
    with an origin of
    androidx.core
    (
    core-1.15.0-runtime.jar
    ).
  • A duplicate class failure from
    checkDebugDuplicateClasses
    or
    checkReleaseDuplicateClasses
    , involving either
    androidx.core
    /
    android.support.v4
    or
    kotlin-stdlib
    (for example
    Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt
    ).

Cause

IAP 5.4.0 depends on Google Play Billing Library 9.0.0, which in turn requires
androidx.core
1.15.0.
androidx.core
1.15.0 is built for Android Gradle Plugin 8 and later.
Unity 2022.3 LTS builds with Android Gradle Plugin 7.4.2 (Gradle 7.5.1). This older plugin and its R8 compiler can't process
androidx.core
1.15.0, which produces the R8 and duplicate class errors above. Google Play Billing Library 9.0.0 also requires a minimum Android API level of 23, which is higher than the Unity default.
The following steps keep IAP 5.4.0 and Google Play Billing Library 9.0.0 in place, and align the affected Android dependencies with versions the Unity 2022.3 toolchain can build.

Resolution

To build IAP 5.4.0 on Unity 2022.3, follow these steps:
  1. Set the minimum API level to 23 or higher
  2. Pin the Android dependencies with a custom Gradle template
  3. Build your project

Set the minimum API level to 23 or higher

  1. Go to Edit > Project Settings > Player > Android > Other Settings.
  2. Set Minimum API Level to Android 6.0 'Marshmallow' (API level 23) or higher.
This satisfies the minimum API level required by Google Play Billing Library 9.0.0.

Pin the Android dependencies with a custom Gradle template

  1. Go to Edit > Project Settings > Player > Android > Publishing Settings.
  2. Under Build, enable Custom Base Gradle Template. Unity creates the file at
    Assets/Plugins/Android/baseProjectTemplate.gradle
    .
  3. Open
    baseProjectTemplate.gradle
    and add the following block at the end of the file:
allprojects { configurations.all { resolutionStrategy { // androidx.core 1.15.0 requires Android Gradle Plugin 8; // pin to the last release compatible with the Unity 2022.3 toolchain. force 'androidx.core:core:1.13.1' force 'androidx.core:core-ktx:1.13.1' // Align the Kotlin standard library to a single version to avoid duplicate classes. force 'org.jetbrains.kotlin:kotlin-stdlib:1.8.22' force 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.22' force 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22' } }}
Keep Custom Base Gradle Template enabled. The dependency versions only apply while Unity builds with this template.

Build your project

Build for Android as usual (File > Build Settings > Android > Build). The build now completes past the minify and duplicate class checks.

Move to Unity 6

The steps above are a supported way to build IAP 5.4.0 on Unity 2022.3, but they hold two Android dependencies below the versions the package targets. Unity 6 ships Android Gradle Plugin 8 and later, so IAP 5.4.0 builds without any of these changes. If you're planning an engine upgrade, moving to Unity 6 removes the need for this configuration.

Copyright © 2026 Unity Technologies
法規事項プライバシーポリシークッキーDocumentation Terms of Use私の個人情報を販売または共有しないプライバシーに関する選択 (クッキー設定)

"Unity" の名称、Unity のロゴ、およびその他の Unity の商標は、米国およびその他の国における Unity Technologies またはその関係会社の商標または登録商標です (詳しくはこちら)。その他の名称またはブランドは該当する所有者の商標です。

一部のページは利便性向上のため機械翻訳を使用しており、内容に不正確な表現が含まれる場合があります。内容に齟齬または不一致が生じた場合は、英語版を正本とします。

  • このページ
    • Symptoms

    • Cause

    • Resolution

      • Set the minimum API level to 23 or higher

      • Pin the Android dependencies with a custom Gradle template

      • Build your project

    • Move to Unity 6

  • 追加リソース
  • What's new in IAP v5
  • Upgrade from IAP v4 to v5
  • Set up IAP for platform-native stores

このページの問題を報告する