【问题标题】:Build error when updating Unity IAP from 1.23.5 to 2.2.4, Manifest merger failed将 Unity IAP 从 1.23.5 更新到 2.2.4 时生成错误,清单合并失败
【发布时间】:2020-12-16 08:19:51
【问题描述】:

好像 Unity IAP 从使用 Google Play Billing 3.0.0 更改为 3.0.1,现在我无法再构建 APK。

当我尝试为 android 构建 APK 时遇到此错误:

* What went wrong:
Execution failed for task ':launcher:processDebugManifest'.
Manifest merger failed : Attribute meta-data#com.google.android.play.billingclient.version@value value=(3.0.1) from [:billing-3.0.1:] AndroidManifest.xml:15:13-34
    is also present at [:GooglePlayBilling:] AndroidManifest.xml:15:13-34 value=(3.0.0).
    Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:13:9-15:37 to override.

我尝试像建议所说的那样添加'tools.replace="android:value"',但它仍然不起作用,我不知道我是否做得正确。我的自定义 AndroidManifest(通过在 Project Setting > Player > Build 中检查“Custom Main Manifest”创建)如下所示:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="[packagename]" android:versionCode="1" android:versionName="1.0">
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <application android:label="@string/app_name" android:icon="@drawable/app_icon">
    <!-- The MessagingUnityPlayerActivity is a class that extends
         UnityPlayerActivity to work around a known issue when receiving
         notification data payloads in the background. -->
    <activity android:name="com.google.firebase.MessagingUnityPlayerActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
      <meta-data
                tools:replace="android:value"
                android:name="com.google.android.play.billingclient.version"
                android:value="3.0.1" />
    </activity>
    <service android:name="com.google.firebase.messaging.MessageForwardingService" android:exported="false" />
    <service android:name="com.google.android.gms.analytics.CampaignTrackingService" />
    <receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
              android:exported="true" >
      <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
      </intent-filter>
    </receiver>
  </application>
</manifest>

在更新 Unity IAP 之前,我可以成功构建而不会出错。我应该如何解决这个问题? 我正在使用 Unity 2019.4.8f1。我从包管理器安装了 Unity IAP。这是资产链接:https://assetstore.unity.com/packages/add-ons/services/billing/unity-iap-68207

【问题讨论】:

  • 感谢您支持我的回答。编码愉快!

标签: android unity3d google-play-billing


【解决方案1】:

嗯,我想通了。有 2 个 .aar 文件都与 Google Billing Library 发生冲突。错误消息中提到了他们的名字(在方括号 [:GooglePlayBilling:] 中)

Assets\Plugins\UnityPurchasing\Bin\Android\billing-3.0.1.aar

Packages/com.google.play.billing/Runtime/Plugins/GooglePlayBilling.aar

我删除了 billing-3.0.1.aar 文件并将 Google Play 结算库更新到 3.1.0,现在可以使用了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-21
    • 1970-01-01
    • 1970-01-01
    • 2017-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多