question

brendan avatar image
brendan asked

How To Resolve Issues With Facebook's New Unity Plugin (7.X)

After upgrading from Facebook's older plugin (6.x) to their latest (7.x). I am getting build errors on Android.

Errors:
1. Found plugins with same names and architectures, Assets/Plugins/Android/libs/android-support-v4.jar (ARMv7) and Assets/Plugins/Android/android-support-v4.jar (ARMv7). Assign different architectures or delete the duplicate.
2. CommandInvokationFailure: Unable to merge android manifests. See the Console for more details.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

There are a few common issues that creep up when working with plugins and building to the Android platform.

  1. There must be exactly 1 .jar file of a given type and platform
  2. Your manifest must be properly set-up and formatted.

These are basic guidelines to get the PlayFab SDK building in the same project as the FB 7.x SDK. Depending on the mix of plugins in your project you may have additional issues that must be resolved.

Steps to resolve Android Build Conflicts:
1. Get the latest PlayFab SDK & open the PlayFabClientSample Unity project.
2. Download the latest Facebook SDK and import the AssetPackage into the PlayFabClientSample project.
3. Switch your build target to Android, and try to build, you should see your first error: "Found plugins with same names and architectures"
4. This occurs when 2+ copies of the same .jar file exist; in this case android-support-v4. Remove extra copies from your project.
5. Try to build again, and you will see the second error, which in some cases can be up to four errors, all referring to the AndroidManifest.
6. This is due to conflicting information around what API sets to expect. To resolve this issue, we need to integrate Facebook SDK properly into our AndroidManifest. Facebook offers a script to make this easy; but first, make a copy of your AndroidManifest outside of the project. I found that in one case, running the Facebook script overwrote the entire manifest, which is not what we want.
7. Within Unity, go to the Facebook editor menu -> Edit Settings, revealing the FacebookSettings Inspector.
8. Inside the inspector make sure you have the right Facebook App Name and App Id
9. Click "Regenerate Android Manifest", this should add ~12 lines to the bottom of your existing manifest.
10. Now the Facebook SDK is properly integrated into the AndroidManifest, you must also add the following line to the <manifest> node
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="23" />

Save your changes, and you should be able to now build to Android targets.

As always,
Let us know if you are continuing to run into Facebook SDK integration issues.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ahmed.yalahwy@gmail.com avatar image
ahmed.yalahwy@gmail.com answered

Hello , it solved my problem

but after building , I think android:minSdkVersion="21" android:targetSdkVersion="23"

is very modern versions , my newest device is 17 !!

also too many devices will not be able to run the game 

I need to make the minimum SDK -> version 9 :))

is it will make a problem ??

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Sorry, why would you need to target an older SDK version? If you're targeting older devices, you should still be using the newer SDK version. Can you clarify?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ahmed.yalahwy@gmail.com avatar image
ahmed.yalahwy@gmail.com answered

I just need the older devices to able to run the game

older devices with lower API than 21

so I am talking about this :- line android:minSdkVersion="21"

after installing the game on bluestacks (API 17)

it made this error , because 17 is less than the minimum (21)

too many devices will not be able to run the game

did you get it ??

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

marcowilliamspf avatar image
marcowilliamspf answered

@ahmed   I'm not sure where you are seeing minSdkVersion being set to 21 ,  our plugin jar file is compiled with the following in the manifest.  

<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="14"/> 

Unity also has a target & min  in the  player settings,  are you overriding the manifest in player settings?  

I'll spend some time tomorrow and look over our entire build process and sample and see if I can identify anything on our end. 

Thanks,

-Marco Williams
Head of Developer Tools
PlayFab

 

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ahmed.yalahwy@gmail.com avatar image
ahmed.yalahwy@gmail.com answered

so why I face this error in case of installing the game on bluestacks

INSTALL_FAIELD_OLDER_SDK

 

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

marcowilliamspf avatar image
marcowilliamspf answered

@ahmed.yalahwy: Okay,  so I took a look at the Facebook SDK.   It appears there are a few changes that you will need to make in order to make this compatible.


First off,  Facebook does not support Android pre sdk 15.  This is their minimum imposed by their build process.   So you will need to manually change the version line in the manifest to this:

<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="23" />

For the .jar file conflict issues,  what I did was create a folder in "Plugins/Android" called  libs and then I moved the following files into it.

  • android-support-v4
  • android-support-v7-appcompat
  • google-play-services

These two steps eliminate the PlayFab & Facebook conflict.  While PlayFab technically supports all the way back to version 10, the minimum requirement for any project is based upon the minimum requirements across all your integrated plugins.  So when using PlayFab with Facebook SDK 7,  the minimum supported version is  Facebook's minimum requirement of SDK version 15 with a build target of 23.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ahmed.yalahwy@gmail.com avatar image
ahmed.yalahwy@gmail.com answered

thank @marco

worked well (Y)

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.