Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Unity IAP 1.23.0 AndroidManifest.xml issues with UDP builds

Discussion in 'Unity IAP' started by matiasticbits, Nov 11, 2019.

  1. matiasticbits

    matiasticbits

    Joined:
    Jan 3, 2017
    Posts:
    30
    After upgrading to Unity IAP 1.23.0 we encountered an issue with building UDP builds:

    Code (CSharp):
    1. CommandInvokationFailure: Gradle build failed.
    2. /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"
    3.  
    4. stderr[
    5. /Users/X/projects/cdh-unity/cdh/Temp/gradleOut/src/main/AndroidManifest.xml:14:91-143 Error:
    6.     Attribute application@name value=(androidx.multidex.MultiDexApplication) from AndroidManifest.xml:14:91-143
    7.     is also present at [:udp:] AndroidManifest.xml:13:18-73 value=(com.unity.udp.sdk.UdpExtendedApplication).
    8.     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".

    Code (bash):
    1. diff udp_1.22.0/AndroidManifest.xml udp_1.23.0/AndroidManifest.xml
    2. 6c6
    3. <     android:versionName="v1.0.2" >
    4. ---
    5. >     android:versionName="v1.2.0" >
    6. 8c8
    7. <     <uses-sdk android:minSdkVersion="15" />
    8. ---
    9. >     <uses-sdk android:minSdkVersion="17" />
    10. 12a13,21
    11. >     <application android:name="com.unity.udp.sdk.UdpExtendedApplication" >
    12. >         <meta-data
    13. >             android:name="UDP_SDK_VERSION"
    14. >             android:value="1.2.0" />
    15. >         <meta-data
    16. >             android:name="UDP_SDK_DIST"
    17. >             android:value="unityiap" />
    18. >     </application>
    19.  
    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?
     
    Last edited: Nov 11, 2019
    Ali_V_Quest likes this.
  2. Ali_V_Quest

    Ali_V_Quest

    Joined:
    Aug 2, 2015
    Posts:
    138
    Have you found a solution for this ?
     
  3. caixuguang

    caixuguang

    Unity Technologies

    Joined:
    Oct 31, 2016
    Posts:
    3
    Could you please try to add 'tools:replace="android:name"' to you application?
    BTW: we will shift a change asap to handle this situation.
     
  4. matiasticbits

    matiasticbits

    Joined:
    Jan 3, 2017
    Posts:
    30
    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.
     
  5. caixuguang

    caixuguang

    Unity Technologies

    Joined:
    Oct 31, 2016
    Posts:
    3
    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.
     
  6. matiasticbits

    matiasticbits

    Joined:
    Jan 3, 2017
    Posts:
    30
    Good to hear. Thank you for clearing this out.