After upgrading to Unity IAP 1.23.0 we encountered an issue with building UDP builds:
CommandInvokationFailure: Gradle build failed.
/Applications/Unity_2018.4.6f1/PlaybackEngines/AndroidPlayer/Tools/OpenJDK/MacOS/bin/java -classpath "/Applications/Unity_2018.4.6f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"
stderr[
/Users/X/projects/cdh-unity/cdh/Temp/gradleOut/src/main/AndroidManifest.xml:14:91-143 Error:
Attribute application@name value=(androidx.multidex.MultiDexApplication) from AndroidManifest.xml:14:91-143
is also present at [:udp:] AndroidManifest.xml:13:18-73 value=(com.unity.udp.sdk.UdpExtendedApplication).
Suggestion: add 'tools:replace="android:name"' to <application> element at AndroidManifest.xml:14:3-43:17 to override.
Seems like AndroidManifest.xml file in Assets/Plugins/UDP/Android/udp.aar for 1.23.0 added a new application configuration which conflicts with the one we have configured in our AndroidManifest.xml. Our minimum Android API level is 19 so we need the define android:name=âandroidx.multidex.MultiDexApplicationâ.
diff udp_1.22.0/AndroidManifest.xml udp_1.23.0/AndroidManifest.xml
6c6
< android:versionName="v1.0.2" >
---
> android:versionName="v1.2.0" >
8c8
< <uses-sdk android:minSdkVersion="15" />
---
> <uses-sdk android:minSdkVersion="17" />
12a13,21
> <application android:name="com.unity.udp.sdk.UdpExtendedApplication" >
> <meta-data
> android:name="UDP_SDK_VERSION"
> android:value="1.2.0" />
> <meta-data
> android:name="UDP_SDK_DIST"
> android:value="unityiap" />
> </application>
The recommended approach of adding tools:replace=âandroid:nameâ into application element in our AndroidManifest.xml does fix the issue, but I wanted to ask for more info about com.unity.udp.sdk.UdpExtendedApplication, what could be the negative impact of this approach and are there any alternative solutions to fix the issue?