- Home /
Having trouble building android project after adding Google Play Games and Google adMob
I could build fine with just google play services but when I added the admob plugin I ran into these errors. Any help would be much appreciated.
The first one
Error: [Temp/StagingArea/AndroidManifest-main.xml:2, /Users/admin/Bottle Flip/Temp/StagingArea/android-libraries/MainLibProj/AndroidManifest.xml:3] Main manifest has but library uses minSdkVersion='15'
UnityEditor.HostView:OnGUI()
Then the second one
CommandInvokationFailure: Unable to merge android manifests. See the Console for more details. /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/admin/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -
stderr[ Error: [Temp/StagingArea/AndroidManifest-main.xml:2, /Users/admin/Bottle Flip/Temp/StagingArea/android-libraries/MainLibProj/AndroidManifest.xml:3] Main manifest has but library uses minSdkVersion='15' ] stdout[ Warning: [Temp/StagingArea/AndroidManifest-main.xml:2, /Users/admin/Bottle Flip/Temp/StagingArea/android-libraries/MainLibProj/AndroidManifest.xml:3] Main manifest has but library uses targetSdkVersion='23' [Temp/StagingArea/AndroidManifest-main.xml, /Users/admin/Bottle Flip/Temp/StagingArea/android-libraries/play-services-base-9.6.1/AndroidManifest.xml:4] Skipping identical /manifest/application/activity[@name=com.google.android.gms.common.api.GoogleApiActivity] element. [Temp/StagingArea/AndroidManifest-main.xml, /Users/admin/Bottle Flip/Temp/StagingArea/android-libraries/play-services-basement-9.6.1/AndroidManifest.xml:5] Skipping identical /manifest/application/meta-data[@name=com.google.android.gms.version] element. Warning: [Temp/StagingArea/AndroidManifest-main.xml:2, /Users/admin/Bottle Flip/Temp/StagingArea/android-libraries/unity-ads/AndroidManifest.xml:3] Main manifest has but library uses targetSdkVersion='23' ] exit code: 1 UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.HostView:OnGUI()
Answer by liortal · Dec 14, 2016 at 08:05 PM
Both of the issues you described are actually the same problem.
Background
Error: [Temp/StagingArea/AndroidManifest-main.xml:2, /Users/admin/Bottle Flip/Temp/StagingArea/android-libraries/MainLibProj/AndroidManifest.xml:3] Main manifest has but library uses minSdkVersion='15'
Your Unity project has an Android manifest of its own (a default one, or a custom one that you can set yourself).
Other Android libraries (plugins) that you add to your project can also contain their own Android manifest, and so the build process has to include (merge) all these manifests together.
Usually, this operation succeeds and is transparent to you as a developer. However, there may be cases where the automatic merging cannot decide how to act properly and so the build process fails.
Root cause for this issue
Taking a look at the error message you posted:
stderr[ Error: [Temp/StagingArea/AndroidManifest-main.xml:2, /Users/admin/Bottle Flip/Temp/StagingArea/android-libraries/MainLibProj/AndroidManifest.xml:3] Main manifest has but library uses minSdkVersion='15' ] stdout[ Warning: [Temp/StagingArea/AndroidManifest-main.xml:2, /Users/admin/Bottle Flip/Temp/StagingArea/android-libraries/MainLibProj/AndroidManifest.xml:3] Main manifest has but library uses targetSdkVersion='23' [Temp/StagingArea/AndroidManifest-main.xml, /Users/admin/Bottle Flip/Temp/StagingArea/android-libraries/play-services-base-9.6.1/AndroidManifest.xml:4]
A bit hard to figure out since the phrasing is a bit off, but you can see that the library uses minSdkVersion = 15, but your main Unity project defines minSdkVersion = 23.
The manifest merger cannot decide which value to pick up.
Solution
You should set this value to match across all used libraries (plugins). The easiest solution would be to set the "Minimum API level" in Player settings to 15.
Your answer
Follow this Question
Related Questions
Google Admob (V.6.1.2) crashing Android game on device built with Unity 2020.3.19 1 Answer
IOException : Failed to Move File / Directory 4 Answers
Possible conflict between plugin, error on build 1 Answer
CommandInvokationFailure: Unable to convert classes into dex format - Unity 1 Answer
com.google.android.gms.ads.MobileAds Issue With Firebase 1 Answer