- Home /
targetSdk is considered missing when I already put it in my custom AndroidManifest.xml
Hi,
I'm using Unity 5.1.2. And I've got this error when I tried building my project:
CommandInvokationFailure: Unable to merge android manifests. See the Console for more details. C:\Program Files\Java\jdk1.7.0_09\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="C:/Android/android-sdk\tools" -Dfile.encoding=UTF8 -jar "C:/Program Files/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -
stderr[
] stdout[ Warning: [Temp\StagingArea\AndroidManifest-main.xml:2, E:\Work\getsocial-unity-sdk\example\GetSocialSDK Demo\Temp\StagingArea\android-libraries\facebook-android-sdk-4.7.0\AndroidManifest.xml:3] Main manifest has android:targetSdkVersion='15'> but library uses targetSdkVersion='23' Note: main manifest lacks a android:targetSdkVersion> declaration, which defaults to value minSdkVersion or 1. Warning: [Temp\StagingArea\AndroidManifest-main.xml:2, E:\Work\getsocial-unity-sdk\example\GetSocialSDK Demo\Temp\StagingArea\android-libraries\facebook-android-wrapper-release\AndroidManifest.xml:3] Main manifest has android:targetSdkVersion='15'> but library uses targetSdkVersion='23' Note: main manifest lacks a android:targetSdkVersion> declaration, which defaults to value minSdkVersion or 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()
In short, I believe this is what happening: Unity didn't recognize any targetSdk although I have it in my Assets/Plugins/Android/AndroidManifest.xml. And so it uses the minSdk for it (the one I set on the player settings, in this case 15). And because on of the library is using targetSdk of 23, it got conflicted. So, what is wrong with this? Is a custom AndroidManifest.xml not recognized anymore? How do one make a custom AndroidManifest.xml? Is it not making it in the "Assets/Plugins/Android"? How do I solve this without having to change the library's xml file?
Oh yeah, BTW, if you are wondering, the said library is the latest Facebook SDK. In its aar files, there's an AndroidManifest.xml that has minSdk = 15 and targetSdk = 23.
Thanks in advance.
Answer by bawenang · Oct 27, 2015 at 09:43 AM
Okay, I finally solved this. I deleted all instances and files of the plugins and libraries (Facebook being one of them), and then reimported the packages of the plugins back. And what do you know, it worked. Weird.
Answer by traunay · Oct 22, 2015 at 04:03 PM
I haven't tried the latest fb sdk yet but I'm using the one before 23 (21 since i havent updated my android sdk yet) and evertyhing's fine.
Have you tried to export the android project? that way you can see your own androidmanifest.xml and there will be a facebook folder as well with its androidmanifest.xml
btw this what's on my project androidmanifest.xml which seems correct to me
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="21" />
and this is actually what's on my fb androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
* Copyright 2010-present Facebook.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.android">
<application/>
<uses-sdk android:minSdkVersion="6" />
</manifest>
I'm not sure why yours have targetSDK 23 though.. my suggestion rollback your android sdk (maybe unity 5.1.2 doesnt recognize it yet? lol) or your fb sdk for that matter.
Well, the latest facebook sdk using android:targetSdkVersion="23"
in the Android$$anonymous$$anifest.xml in both of its aar files (facebook-android-sdk-4.7.0.aar & facebook-android-wrapper-release.aar). I tried removing this in the manifests, rezipped the aar and build it. When I tried building it, it took a long time. But that's maybe because of my crappy computer though. LoL. But still, that's not really the best way to do it. It's kind of hackish.