Unable to merge android manifests error

748 views
Skip to first unread message

Durgesh Kaushik

unread,
Jul 19, 2018, 9:43:05 PM7/19/18
to Google Mobile Ads SDK Developers
 i m not able to build my apk after implementing ads 
here is a screenshot for that -  

 m getting this error -

1-  CommandInvokationFailure: Unable to merge android manifests. See the Console for more details. 
C:\Program Files\Java\jdk1.8.0_131\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Program Files (x86)/Android/android-sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

stderr[

]
stdout[
Warning: [Temp\StagingArea\AndroidManifest-main.xml:12, J:\Unity Projects\Ball Breaker\Temp\StagingArea\android-libraries\android.arch.lifecycle.runtime-1.0.0\AndroidManifest.xml:3] Main manifest has <uses-sdk android:targetSdkVersion='25'> but library uses targetSdkVersion='26'
[Temp\StagingArea\AndroidManifest-main.xml, J:\Unity Projects\Ball Breaker\Temp\StagingArea\android-libraries\com.android.support.support-compat-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element.
[Temp\StagingArea\AndroidManifest-main.xml, J:\Unity Projects\Ball Breaker\Temp\StagingArea\android-libraries\com.android.support.support-core-ui-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element.
[Temp\StagingArea\AndroidManifest-main.xml, J:\Unity Projects\Ball Breaker\Temp\StagingArea\android-libraries\com.android.support.support-core-utils-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element.
[Temp\StagingArea\AndroidManifest-main.xml, J:\Unity Projects\Ball Breaker\Temp\StagingArea\android-libraries\com.android.support.support-fragment-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element.
[Temp\StagingArea\AndroidManifest-main.xml, J:\Unity Projects\Ball Breaker\Temp\StagingArea\android-libraries\com.android.support.support-media-compat-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element.
[Temp\StagingArea\AndroidManifest-main.xml, J:\Unity Projects\Ball Breaker\Temp\StagingArea\android-libraries\com.android.support.support-v4-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element.
]
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()


2- Error building Player: 2 errors

and here is my android manifests code -


<?xml version="1.0" encoding="utf-8"?>
<!--
This Google Mobile Ads plugin library manifest will get merged with your
application's manifest, adding the necessary activity and permissions
required for displaying ads.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   
package="com.google.unity.ads"
   
android:versionName="1.0"
   
android:versionCode="1">
 
<uses-sdk android:minSdkVersion="14"
     
android:targetSdkVersion="19" />
   
<application>
     
<activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
   
android:label="@string/app_name">
   
<intent-filter>
     
<action android:name="android.intent.action.MAIN" />
     
<category android:name="android.intent.category.LAUNCHER" />
   
</intent-filter>
   
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
   
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik"
       
android:value="true" />
</activity>
 
</application>
</manifest>


and here is the code for the script  i m using to implement ads on it -


using UnityEngine;
using System.Collections;
using GoogleMobileAds;
using GoogleMobileAds.Api;


public class LevelManager : MonoBehaviour {


 
public void LoadLevel(string name){
 
Debug.Log ("New Level load: " + name);
 
Brick.breakableCount = 0;
 
Application.LoadLevel (name);
 
}


 
public void QuitRequest(){
 
Debug.Log ("Quit requested");
 
Application.Quit ();
 
}
 
 
public void LoadNextLevel() {
 
Brick.breakableCount = 0;
 
Application.LoadLevel(Application.loadedLevel + 1);
 
}
 
 
public void BrickDestoyed() {
 
if (Brick.breakableCount <= 0) {
 
LoadNextLevel();
 
}
 
}
}


public class GoogleMobileAdsDemoScript : MonoBehaviour
{
 
private BannerView bannerView;
 
   
public void Start()
 
{
#if UNITY_ANDROID
 
string appId = "ca-app-pub-3940256099942544~3347511713";
#elif UNITY_IPHONE
           
string appId = "ca-app-pub-3940256099942544~1458002511";
#else
           
string appId = "unexpected_platform";
#endif


 
// Initialize the Google Mobile Ads SDK.
 
MobileAds.Initialize(appId);


 
this.RequestBanner();
 
}


 
private void RequestBanner()
 
{
#if UNITY_ANDROID
 
string adUnitId = "ca-app-pub-3940256099942544/6300978111";
#elif UNITY_IPHONE
           
string adUnitId = "ca-app-pub-3940256099942544/2934735716";
#else
           
string adUnitId = "unexpected_platform";
#endif


 
// Create a 320x50 banner at the top of the screen.


 
AdSize adSize = new AdSize(320, 100);
 bannerView
= new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);


 bannerView
.Destroy();


 
// Create an empty ad request.
 
AdRequest request = new AdRequest.Builder().Build();


 
// Load the banner with the request.
 bannerView
.LoadAd(request);
 
}


 
private void RequestInterstitial()
 
{
#if UNITY_ANDROID
 
string adUnitId = "ca-app-pub-3940256099942544/1033173712";
#elif UNITY_IPHONE
       
string adUnitId = "ca-app-pub-3940256099942544/4411468910";
#else
       
string adUnitId = "unexpected_platform";
#endif


 
// Initialize an InterstitialAd.
 
InterstitialAd interstitial = new InterstitialAd(adUnitId);


 
// Create an empty ad request.
 
AdRequest request = new AdRequest.Builder().Build();
 
// Load the interstitial with the request.
 interstitial
.LoadAd(request);
   
}
}





please solve this problem.

mobileadssdk-a...@google.com

unread,
Jul 20, 2018, 3:22:45 AM7/20/18
to Durgesh Kaushik, Google Mobile Ads SDK Developers
Hi Durgesh,

Thank you for providing the error logs captured and other helpful details.

The error logs captured seem to suggest that there are some mismatch between manifest files that prevented them from merging properly and resulted to the build error.

Looking at your manifest file for the plugin, you seem to have added these additional snippets which should only be implemented when you are building using Unity 4. That said, could you confirm which Unity IDE version are you using to build your app?

For us to have a better look on this, could you provide to us privately (using Reply privately to author option) the Unity project you are trying to build where you encountered the build error so we can test it on our end?

On our end, I tested our HelloWorld example app and I was able to build it successfully. I didn't modify the plugin's manifest file anymore because I'm building the app using Unity 2018.1.1f1.

Regards,
Ivan Bautista
Mobile Ads SDK Team

Message has been deleted
Message has been deleted
Message has been deleted

mobileadssdk-a...@google.com

unread,
Jul 23, 2018, 3:08:17 AM7/23/18
to Durgesh Kaushik, Google Mobile Ads SDK Developers
Hi Durgesh,

Thank you for your patience and for providing to us a copy of your project. We were able to receive the private email you've sent using the Reply privately to author option. Also, we deleted your response in this public thread containing the link to your sample project.

I tested your Unity project on my end and I was able to build and run the game successfully without getting the merging error you've encountered on your end. 

Is it possible for you to try building our HelloWorld example app on your end and see if you get the same build error?

Durgesh Kaushik

unread,
Jul 23, 2018, 5:24:28 AM7/23/18
to Google Mobile Ads SDK Developers
Here Is The Real Problem I Think i having Trouble with sdk versions these guys has the same problem - 

and they are able to solve it but i can't. here is the error Log - 


CommandInvokationFailure: Unable to merge android manifests. See the Console for more details.
C
:\Program Files\Java\jdk1.8.0_131\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Program Files (x86)/Android/android-sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -


stderr
[


]
stdout
[
Warning: [Temp\StagingArea\AndroidManifest-main.xml:12, J:\Unity Projects\Ball Breaker\Temp\StagingArea\android-libraries\android.arch.lifecycle.runtime-1.0.0\AndroidManifest.xml:3] Main manifest has <uses-sdk android:targetSdkVersion='25'> but library uses targetSdkVersion='26'
[Temp\StagingArea\AndroidManifest-main.xml, J:\Unity Projects\Ball Breaker\Temp\StagingArea\android-libraries\com.android.support.support-compat-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element.
[Temp\StagingArea\AndroidManifest-main.xml, J:\Unity Projects\Ball Breaker\Temp\StagingArea\android-libraries\com.android.support.support-core-ui-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element.
[Temp\StagingArea\AndroidManifest-main.xml, J:\Unity Projects\Ball Breaker\Temp\StagingArea\android-libraries\com.android.support.support-core-utils-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element.
[Temp\StagingArea\AndroidManifest-main.xml, J:\Unity Projects\Ball Breaker\Temp\StagingArea\android-libraries\com.android.support.support-fragment-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element.
[Temp\StagingArea\AndroidManifest-main.xml, J:\Unity Projects\Ball Breaker\Temp\StagingArea\android-libraries\com.android.support.support-media-compat-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element.
[Temp\StagingArea\AndroidManifest-main.xml, J:\Unity Projects\Ball Breaker\Temp\StagingArea\android-libraries\com.android.support.support-v4-26.1.0\AndroidManifest.xml:6] Skipping identical /manifest/application/meta-data[@name=android.support.VERSION] element.
Warning: [Temp\StagingArea\AndroidManifest-main.xml:12, J:\Unity Projects\Ball Breaker\Temp\StagingArea\android-libraries\GoogleMobileAdsPlugin\AndroidManifest.xml:2] Main manifest has <uses-sdk android:targetSdkVersion='25'> but library uses targetSdkVersion='26'

]
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()

 can you please give me some answers to how to set the sdk versions 
from 25 to 26 or do i have to update my sdk or Unity...???
Message has been deleted

Durgesh Kaushik

unread,
Jul 23, 2018, 7:44:40 AM7/23/18
to Google Mobile Ads SDK Developers
the error is resolved i just downloaded android studio and then copy pasted the sdk folder path into unity sdk preferences.
but ads are not showing when i build apk and tested on a real device can you help me with that please.

also when i tested hello world apk in unity 5.6.4p2 there is a lot of errors.



On Monday, 23 July 2018 12:38:17 UTC+5:30, mobileadssdk-a...@google.com wrote:

mobileadssdk-a...@google.com

unread,
Jul 24, 2018, 2:23:39 AM7/24/18
to Durgesh Kaushik, Google Mobile Ads SDK Developers
Hi Durgesh,

I’m Ivan's colleague and I’ll be assisting you on this.

Thanks for getting back to us with additional helpful information.

Looking at the errors from the screenshot you've shared to us, it seems you haven't imported the Mobile Ads Unity plugin in the HelloWorld sample app. That said, please refer to this guide on how to download and import the Mobile Ads Unity plugin.

On the other hand, could you provide the complete error logs you've received while trying to load Ads using your app?

Regards,
Steven Balan
Mobile Ads SDK Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Ramsha Rumaan

unread,
Aug 3, 2018, 4:34:00 AM8/3/18
to Google Mobile Ads SDK Developers
I am also facing the same issue while building an apk. for Admob Project. Have tried everything so far but still stuck at this very point. Can anyone help with this?

mobileadssdk-a...@google.com

unread,
Aug 3, 2018, 6:11:06 AM8/3/18
to Ramsha Rumaan, Google Mobile Ads SDK Developers
Hi there,

Thanks for reaching out to us.

Could you provide to us the complete error logs you've received when trying to build your Unity project? Also, could you try to build our HelloWorld sample app on your end and see if you will encounter the same error?

On the other hand, we can try to build your Unity project on our end, if you will send it to us privately using the Reply privately to author option.

Regards,
Steven Balan
Mobile Ads SDK Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Reply all
Reply to author
Forward
0 new messages