Look like Unity IAP changed from using Google Play Billing 3.0.0 to 3.0.1, and now I can't build APK anymore.
I'm getting this error when I try to build APK for android:
* 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.
I tried adding 'tools.replace="android:value"' like the suggestion say but it still doesn't work, I don't know if I did it correctly. My custom AndroidManifest (which is created from checking "Custom Main Manifest" in Project Setting > Player > Build) looks like this:
<?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>
Before updating Unity IAP, I can build successful without errors. How should I fix this? I'm using Unity 2019.4.8f1. I installed the Unity IAP from Package Manager. This is the asset link: https://assetstore.unity.com/packages/add-ons/services/billing/unity-iap-68207
Well I figured it out. There are 2 .aar files that both do something with Google Billing Library causing the conflict. Their names are mentioned in the error message (in the square brackets [:GooglePlayBilling:])
Assets\Plugins\UnityPurchasing\Bin\Android\billing-3.0.1.aar
and
Packages/com.google.play.billing/Runtime/Plugins/GooglePlayBilling.aar
I deleted the billing-3.0.1.aar file and update Google Play Billing Library to 3.1.0 and it works now.