Repro - Mobile Analytics for growth
日本語
Sign Up Back to Dashboard
  • System Requirements
  • Dashboard Guide
  • Development Guide
  • Release Notes
  • FAQ

How to resolve AndroidManifest.xml merge conflict build errors on old unity versions.¶

Sometimes old Unity versions can cause a build error when the build process starts to merge AndroidManifest.xml files.

CommandInvokationFailure: Unable to merge android manifests. See the Console for more details.
/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/john/Library/Android/sdk.old/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity5.4.5/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

stderr[

]
stdout[
[Temp/StagingArea/AndroidManifest-main.xml:25, /Users/john/sample/unity5/Temp/StagingArea/android-libraries/repro-android-sdk-2.7.9/AndroidManifest.xml:11] Skipping identical /manifest/application/receiver[@name=com.sample.notification.IntentHandler] element.
Warning: [Temp/StagingArea/AndroidManifest-main.xml:31, /Users/john/sample/unity5/Temp/StagingArea/android-libraries/repro-android-sdk-2.7.9/AndroidManifest.xml:3] Main manifest has <uses-sdk android:targetSdkVersion='25'> but library uses targetSdkVersion='26'
]

Reason

From this release onwards, the AndroidManifest.xml file of Repro.unitypackage includes a uses-sdk clause in order to define the targetSdkVersion. Normally the App's targetSdkVersion should have priority, but older Unity version won't ignore this setting and an error occurs.

Note

Please refer to this document for further details on AndroidManifest.xml merging errors.

The following steps should solve AndroidManifest.xml merge problems.

Solution

  1. Remove the AAR file from Assets > Plugins > Android > libs in your unity project.

  2. Copy the AAR file from removed-uses-sdk-aar to Assets > Plugins > Android > libs in your unity project.

Replace android sdk without uses-sdk tag.

In this copied aar file, the AndroidManifest.xml's uses-sdk clause is empty and the Android SDK Tool can be used to add needed permissions listed below.

  • READ_PHONE_STATE
  • WRITE_EXTERNAL_STORAGE
  • READ_EXTERNAL_STORAGE

If your app does not need all of these permissions, you can exclude them with these tags.

<application ...

+    <uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />

...

</application>

Note

For more details on Manifest merging, please refer to this article.

About Us Careers Terms of Service Privacy Policy Cookie Policy

© 2022 Repro Inc.