Unity IAP 1.23.0 AndroidManifest.xml issues with UDP builds

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?

1 Like

Have you found a solution for this ?

Could you please try to add ‘tools:replace=“android:name”’ to you application?
BTW: we will shift a change asap to handle this situation.

As mentioned adding ‘tools:replace=“android:name”’ to the application element does fix the issue. We are just worrying what kind of side effects this could add.

The two applicationNames have conflicted, one is your MultiDexApplication and the other is UdpExtendedApplication . The UdpExtendedApplication has empty implementation now. So there shouldn’t be any side effects.

Good to hear. Thank you for clearing this out.