Search Unity

`Facebook.Unity.Settings' has already been imported error

Discussion in 'Unity Build Automation' started by Bruder, Apr 25, 2017.

  1. HaakonL

    HaakonL

    Joined:
    Mar 13, 2014
    Posts:
    123
    Cloud builds are failing for us, using 2017.1.p5, Facebook SDK 7.1.10 and build target is iOS.

    An assembly with the same name `Facebook.Unity.Gameroom' has already been imported. Consider removing one of the references or sign the assembly
     
  2. unity-tuesday

    unity-tuesday

    Unity Technologies

    Joined:
    Aug 2, 2016
    Posts:
    42
    Thanks, everyone, for sharing this issue that you're encountering, and for also recommending fixes and workarounds that worked for you! I'm sorry that you haven't seen one of us in this thread when you were expecting to, though we have been aware of and tracking this particular problem.

    While this was an issue that first appeared a few months ago, it looked to be resolved after updating the Facebook SDK version on our end. Since then, we haven't been able to reproduce this issue, though there is clearly still an impact to you folks on here.

    What would help us investigate this for those still running into the problem would be a minimal example project showing the behavior, and letting us know the steps performed to integrate the SDK. Please feel free to send this data my way if you can, as we definitely would like to see everyone up and running again!
     
  3. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    Here are steps to reproduce the core error in Unity. You shouldn't need an example project.

    1. Install Unity 5.6 (I used 5.6.3p3 on Mac) with the Facebook and Windows build options
    2. Go to Build Settings -> Facebook -> Player Settings -> Publishing Settings
    3. Change the Facebook SDK Setting to 7.10.1

    At this point, you should see the error in the Console,

    "Extension Library/FacebookSDK/Facebook.Unity.Gameroom.dll was not registered, that means it relies on default UnityExtensions settings, please register extension and apply necessary settings for it in the callback."

    This error won't occur with 7.9.4 or 7.9.1 settings.

    The other observation is that the Unity/PlaybackEngines/Facebook/SDK directory contains old 7.9.1 dll files. Also, that Unity gives directions to change the Player Settings mentioned above, which then produces the error.

    FWIW, I haven't solved the issue myself yet, but will be attempting fixes based on this thread.
     
    ilmario likes this.
  4. Vladimitrius

    Vladimitrius

    Joined:
    Apr 4, 2017
    Posts:
    4
    I confirm the same issue using 2017.1.1f1
     
  5. ilmario

    ilmario

    Joined:
    Feb 16, 2015
    Posts:
    71
    I'm also having the issue on the latest patch release, Unity 2017.1.1p3
     
  6. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    785
    If you're going to report an error here related to the Facebook SDK you need to be specific about which error you're seeing. This thread was specifically referencing the 'Facebook.Unity.Settings' errors, and several others have been reported here which may look similar but are potentially unrelated (please start a new thread for those).

    So lets look closer at this "An assembly with the same name 'Facebook.Unity.Settings' has already been imported." error. This only seems to happen when you are including a copy of the Facebook SDK in your project directly. This use case should work fine, however I want to point out a couple of things specifically.

    As has been referred to in this thread already, there is a "facebookSdkVersion" stored in your ProjectSettings (you can inspect manually at ProjectSettings/ProjectSettings.asset). If you're using the built in Facebook SDK it will have some version number there (ex: "facebookSdkVersion: 7.9.4"). However, if you include a copy of the Facebook SDK in your Assets/ directory and save the project you will notice something like "facebookSdkVersion: pluginIncompatible" (meaning Unity will now try to use the Facebook SDK in your Assets/).

    For cases where this error shows up in Unity Cloud Build, if you look closely at the build logs that error is only printed out during the first launch of Unity, before the actual player is built. Unity detects that you have the Facebook SDK included in your project and automatically fixes up the ProjectSettings to accomodate (i.e sets "facebookSdkVersion: pluginIncompatible"). During the actual build phase (i.e. after the "Building Unity player" message in the logs), it should be using the correct Facebook SDK. That implies that the most likely cause of this error in Unity Cloud Build is that you didn't commit your ProjectSettings changes along with your project (or didn't save your project before pushing the Facebook SDK to your repo).

    This also means that error should not cause your build to fail. If you have a failed build with that error message in it, that error most likely was not the cause of the actual failure (although I can see how it is very misleading). In general, you will need to look at the full log to determine the cause of the failure. Our highlighting of errors/warnings is very basic so sometimes the actual cause may take a bit of reading back through the log to find. If you'd like me to inspect your build logs more closely, please send me a PM with a link to your build log.



    @SniperED007 - your build failures are not related to the facebook sdk errors (looks to me like you need to switch to xcode 8 or higher in your target config):

    @HaakonL - those "Facebook.Unity.Gameroom" errors look like a legitimate cause of the failure, but looks like you've built successfully since - I'm assuming you just remove the Facebook SDK from your project, or updated to a newer version?

    @kwikdev - that looks like a different error unrelated to Unity Cloud Build. Have you reported it through the editor? Possibly also related to https://issuetracker.unity3d.com/is...llation-standalone-build-finishes-with-errors

    @Vladimitrius and @ilmario - I didn't find any projects in UCB for you. Send me a PM if you need help there.
     
  7. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    345
    @dannyd I tried switching to Xcode 9. But if I do an iOS build I still get this error:

    [Unity] Initialize engine version: 2017.1.1p1 (007fc09e806c)
    [Unity] UnityEngine.Debug:LogWarning(Object)
    [Unity] UnityEngine.Debug:LogWarning(Object)
    [Unity] UnityEngine.Debug:LogWarning(Object)
    [Unity] UnityEngine.Debug:LogWarning(Object)
    [Unity] WARNING: 270625200 format is not supported, decompressing texture
    [Unity] -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp-firstpass.dll
    [Unity] Compilation failed: 1 error(s), 0 warnings
    [Unity] error CS1704: An assembly with the same name `Facebook.Unity.Settings' has already been imported. Consider removing one of the references or sign the assembly
    [Unity] Library/FacebookSDK/Facebook.Unity.Settings.dll (Location of the symbol related to previous error)
    [Unity] Assets/FacebookSDK/Plugins/Settings/Facebook.Unity.Settings.dll (Location of the symbol related to previous error)
    [Unity] error CS1704: An assembly with the same name `Facebook.Unity.Settings' has already been imported. Consider removing one of the references or sign the assembly
    [Unity] Library/FacebookSDK/Facebook.Unity.Settings.dll (Location of the symbol related to previous error)
    [Unity] Assets/FacebookSDK/Plugins/Settings/Facebook.Unity.Settings.dll (Location of the symbol related to previous error)
    [Unity] Compilation failed: 1 error(s), 0 warnings
    Unhandled Exception: System.NullReferenceException: DownloadHandler has already been destroyed
    [usbmuxd] Error:
    [Unity] Initialize engine version: 2017.1.1p1 (007fc09e806c)
     
  8. ilmario

    ilmario

    Joined:
    Feb 16, 2015
    Posts:
    71
    Sorry for not being clear. I'm not using Cloud build, and I havent added Facebook SDK manually either.

    I was using the inbuilt version with the newer SDK : 7.10.1, but downgraded to 7.9.4, which seemed to have fixed the error I was seeing. I will keep it downgraded until it works reliable in Unity.

    I though that this error was related to weird Facebook Gameroom-issues, such as Standalone resolution settings not being respected on game start. The first scene (which last only a few seconds, preloading the next one), is shown up tiny, like 1/30 of the screen in left upper corner. The next scene works almost ok in normal screen size, except the input is weirdly connected to the tiny screen area of the previous screen. The input problem fixes itself if the gameroom window is manually resized in any way during the preloading scene or the next one. Probably I need to trigger this resizing somehow in a script.

    This seems to occur regardless of Standalone resolution / full screen settings, and it happens only in Gameroom, not other Mac/Win builds. This particular problem might also be connected to the Adventure Creator asset.

    However, this issue also persists regardless of the error related to the Facebook SDK, so it's not connected.
     
  9. HashbangGames

    HashbangGames

    Joined:
    May 7, 2011
    Posts:
    40
    I found a new solution for this problem. Unity is supposed to automatically disable this namespace when you install the Facebook SDK manually. However it is failing to disable it.

    1> Import latest FacebookSDK
    2> Click on FacebookSDK --> Plugins -->Settings-->Facebook.Unity.Settings in the project
    3> Uncheck Any Platform, then unselect all from Exclude ( this is what I did, not sure if it is relevant )
    4> Let it recompile ( you will get errors )
    5> Delete the FacebookSDK from your project
    6> Re-Install FacebookSDK & Restart Unity

    This worked for me, I now have no errors and the FacebookSDK works fine because Unity Detected the FacebookSDK and disabled the Namespace Facebook.Unity.Settings

    Please post if this solution worked for you, I don't know 100% that this solution works every time, it just worked for me after fudging with it for about 10 minutes.
     
  10. htdreams

    htdreams

    Joined:
    Mar 29, 2014
    Posts:
    11
    I was lost for several days without any clue on how to resolver this issue... thanks #blumersolutions, your "recipe" worked flawlesly for me :-D
     
  11. lukos

    lukos

    Joined:
    Nov 11, 2012
    Posts:
    22
  12. lukos

    lukos

    Joined:
    Nov 11, 2012
    Posts:
    22
  13. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    Has anybody on this thread actually reported a bug with the bug reporter?
     
  14. rankornfeld

    rankornfeld

    Joined:
    Sep 29, 2016
    Posts:
    57
    I just gave up on cloud build because of this issue and other issues that were sometimes appearing out of nowhere..

    I think cloud build is a great idea, but has a lot of problems.

    Moved to local iOS builds, everything is working great
     
  15. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    345
    Turns out the error ALWAYS happens in the iOS cloud build no matter what you do if you have Facebook SDK installed, however, the build doesn't actually fail because of the error, it just looks that way because it's the error right at the top.
    I got my build to finally work after updating a 3rd party plugin I use that was causing some other error.
     
  16. levi9687

    levi9687

    Joined:
    Dec 17, 2017
    Posts:
    4
    i thought this would work for me also but still no luck I cant find the original dll the error refers to. so annoying
     
  17. teexiii

    teexiii

    Joined:
    Oct 7, 2015
    Posts:
    15
    This should work!
     
  18. lukos

    lukos

    Joined:
    Nov 11, 2012
    Posts:
    22
    Trisibo likes this.
  19. pixelsplit

    pixelsplit

    Joined:
    Sep 16, 2013
    Posts:
    173
    A better fix than removing facebook folders is opening the ProjectSettings.asset with your prefered editor and replacing facebookSdkVersion: x with facebookSdkVersion: plugin
     
  20. Jonathanlive

    Jonathanlive

    Joined:
    Feb 2, 2018
    Posts:
    1
    @PaulECoyote Nice!!!

    then I saved while Unity editor was closed
    facebookSdkVersion: plugin

    I did the samething above and this works for me!!!
    Many thanks bro

    My unity version is: 2017.3.0f3
    My facebook plugin version is: 7.11.0.0

     
  21. lukos

    lukos

    Joined:
    Nov 11, 2012
    Posts:
    22
    @zkw This wont work for cloud build mine is set as plugin and still same issue
     
  22. spacepluk

    spacepluk

    Joined:
    Aug 26, 2015
    Posts:
    243
    This is now working for me on UCB without any workarounds. I'm building for Android and iOS with Unity 2017.3.1f1 and Facebook SDK 7.10.0 (later versions of FBSDK fail to link on iOS).

    I still see this errors in the log, but the builds finish successfully and they work:

    ...
    4707: [Unity] error CS1704: An assembly with the same name `Facebook.Unity.Settings' has already been imported. Consider removing one of the references or sign the assembly
    4708: [Unity] Library/FacebookSDK/Facebook.Unity.Settings.dll (Location of the symbol related to previous error)
    4709: [Unity] Assets/FacebookSDK/Plugins/Settings/Facebook.Unity.Settings.dll (Location of the symbol related to previous error)
    ...

    I had to clean up the library cache before it started building successfully.
     
  23. topXight

    topXight

    Joined:
    Feb 16, 2016
    Posts:
    39
    We started to see this error after updating Facebook Unity SDK to 7.12.

    Compilation failed: 1 error(s), 0 warnings
    29: [Unity] error CS1704: An assembly with the same name `Facebook.Unity.Settings' has already been imported. Consider removing one of the references or sign the assembly
    30: [Unity] Library/FacebookSDK/Facebook.Unity.Settings.dll (Location of the symbol related to previous error)
    31: [Unity] Assets/FacebookSDK/Plugins/Settings/Facebook.Unity.Settings.dll (Location of the symbol related to previous error)
    32: [Unity] -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp.dll


    Unlike previous posts for us the UCB just fails to build past this error.

    Is there an official response from Unity on how to resolve this? We have tried all of the remedies listed above and nothing seems to work for us.
     
  24. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    I regularly have to do this on every new project that used the downloaded Facebook SDK from https://developers.facebook.com/docs/unity (which we use for Facebook features on Android and iOS targets).
     
  25. topXight

    topXight

    Joined:
    Feb 16, 2016
    Posts:
    39
    @Claytonious Thank for for pointing this. I did try this solution but it gave me a parse error on UCB. So I am not sure this works anymore (Unity 2014.7.x or above). Anyway with the gradle builds this error is getting ignored. And the binaries work fine. So I am going to ignore until something stops working.

    And just as FYI I also noticed in the log that the compatible SDK versions for Unity 2017.4.1f1 are 7.9.x and 7.10.x. So I also downgraded FB SDK to 7.10.x.
     
  26. Deleted User

    Deleted User

    Guest

    Changing the facebook value of ProjectSettings to plugin isn't working for me. Even though it says plugin Unity is still always re-adding facebook related .dll files to the library folder.
     
  27. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    I see what @manoke sees, with these repro steps:

    1. Create empty project in Unity 2017.4.5f1 or 2018
    2. Build on Unity Cloud Build for Android successfully
    2. Add FacebookSDK 7.12
    3. Build fails with errors...

    [Unity] error CS1704: An assembly with the same name `Facebook.Unity.Settings' has already been imported. Consider removing one of the references or sign the assembly
    [Unity] Library/FacebookSDK/Facebook.Unity.Settings.dll (Location of the symbol related to previous error)
    [Unity] Assets/FacebookSDK/Plugins/Settings/Facebook.Unity.Settings.dll (Location of the symbol related to previous error)
    [Unity] error CS1704: An assembly with the same name `Facebook.Unity.Settings' has already been imported. Consider removing one of the references or sign the assembly
    [Unity] Library/FacebookSDK/Facebook.Unity.Settings.dll (Location of the symbol related to previous error)
    [Unity] Assets/FacebookSDK/Plugins/Settings/Facebook.Unity.Settings.dll (Location of the symbol related to previous error)

    Is there a known patch-fix to get Android up and running? The above haven't worked in Unity 2017.4.5 or 2018.
     
  28. Spaniel

    Spaniel

    Joined:
    Dec 23, 2012
    Posts:
    52
    Worked for us as well: changing the version in ProjectSettings.asset to "plugin"
     
  29. NanoMath

    NanoMath

    Joined:
    Dec 22, 2012
    Posts:
    33
    so which Unity version should I use to work with Facebook SDK ? which Facebook SDK one ? I've fixed error by removing Facebook library and PlaybackEngine but Unity 2017.4.2.f2 (64bit) cannot build Android app correctly.

    Unity support team hope you will help and close this issue for all other developers :) let's see, the time will show us !
     
  30. Speedrun-Labs

    Speedrun-Labs

    Joined:
    Aug 1, 2014
    Posts:
    16
    both solutions mentioned above seemed to work for me on Unity Cloud Build....

    1 go to /ProjectSettings/ProjectSettings.asset
    2 set "facebookSdkVersion: plugin" or "facebookSdkVersion: 7.13.0" (or current version)

    apparently Unity has some Facebook dll files locally, and Unity Cloud Build has some in their "Library" folder as well

    Unity should fix this issue, goddamnit! >: (
     
    marauderkr likes this.
  31. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,699
    Wow. Still a bug.
     
  32. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,699
    I just deleted said file and it appears to have worked.
    I was hesitant as it claimed 2 existed, but only 1 was shown in the search.

    Anyhoo, hopefully that is it!
     
    Last edited: Sep 5, 2018
  33. hamza37

    hamza37

    Joined:
    Feb 5, 2017
    Posts:
    10
    I know this is late .........unity add facebook sdk by default which can be found in Library folder of the project.Delete Facebook folder from Library folder and error will be gone.This worked for me.
     
  34. Ki4Chan

    Ki4Chan

    Joined:
    Jul 2, 2017
    Posts:
    24
    I am getting Facebook.Unity.Setting has already been imported.

    First I tried to delete the one which is present in "Library", but after that, I get "Facebook.Unity.Setting" is missing error, though the other "Facebook.Unity.Setting" was already there.

    After that, I tried to delete the one imported while importing Facebook SDK but after deleting this one, I can not access "Facebook > Edit Settings".

    EDIT: Closing and then reopening Unity resolved this problem for me.
     
    Last edited: Oct 4, 2018
  35. spacepluk

    spacepluk

    Joined:
    Aug 26, 2015
    Posts:
    243
    I'm working on a new project and I'm still having this problem on Cloud Build with the latest Facebook SDK (7.13 at the moment). I tried setting the version to "plugin" in ProjectSettings but that didn't help.

    Reverting to 7.10 and a clean build "fixed" it again, but I'm not happy about using a version of the SDK that's a year old.
     
    marauderkr likes this.
  36. yunknuy

    yunknuy

    Joined:
    Nov 17, 2018
    Posts:
    1
    Thank you so much !
     
  37. Jeremy-Lv

    Jeremy-Lv

    Joined:
    Mar 17, 2013
    Posts:
    16
    How to Change ?? Only Change the version num ?? such as "facebookSdkVersion: 7.15.1" or "facebookSdkVersion: plugin" ? ,but it both not worked for me....
     
    Last edited: Mar 16, 2019
  38. alexman

    alexman

    Joined:
    Jul 11, 2012
    Posts:
    17
    I am using 2018.2.20 and using cloud build, encountered this problem, fixed it by changing the projectsettings.asset config file manually, change the facebookSdkVersion from 7.9.6 to plugin, worked
     
  39. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    1,166
    Happen to caught this issue with 2019.2.0b5
     
    marauderkr likes this.
  40. marauderkr

    marauderkr

    Joined:
    Jun 10, 2014
    Posts:
    46
    We got the same problem with 2019.2.0f1 and cloud build.

    Local builds work without any problems using Facebook SDK 7.13.
    But Cloud Build throws errors and fails:

    Code (CSharp):
    1. [Unity] [API Updater] Update finished with error in 30336 ms (0/31 assemblie(s) updated).
    2. 17: [Unity] -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Unity.2D.Tilemap.Editor.dll
    3. 18: [Unity] error CS1704: An assembly with the same simple name 'Facebook.Unity.Settings' has already been imported. Try removing one of the references (e.g. '/UNITY_PATH/Unity/Unity-2019_2_0f1/PlaybackEngines/Facebook/SDK/7.9.4/Facebook.Unity.Settings.dll') or sign them to enable side-by-side.
    4. 19: [Unity] error CS1704: An assembly with the same simple name 'Facebook.Unity' has already been imported. Try removing one of the references (e.g. '/UNITY_PATH/Unity/Unity-2019_2_0f1/PlaybackEngines/Facebook/SDK/7.9.4/Facebook.Unity.dll') or sign them to enable side-by-side.
    and ending with:

    Code (CSharp):
    1. Fatal Error! It looks like another Unity instance is running with this project open.
    2. 63: [Unity] DisplayProgressbar: Unity license
    3. 64: [Unity] Fatal Error! It looks like another Unity instance is running with this project open.
    4. 65: publishing finished successfully.
    5. 66: error: attach failed: Error 1
    6. 67: Finished: FAILURE
    setting ProjectSettings.asset line "facebookSdkVersion" to "plugin" or "7.13.0" as well as using CLEAN BUILD in cloudbuild did NOT help.
     
    Last edited: Aug 6, 2019
  41. grimjim

    grimjim

    Joined:
    Jan 18, 2014
    Posts:
    17
    Same here with 7.15 and 7.17

    Regarding the "Fatal Error! It looks like another Unity instance is running with this project open." I would start a clean build that fixes that.

    Code (CSharp):
    1. [Unity] [API Updater] Update finished with error in 30336 ms (0/31 assemblie(s) updated).
    2. 17: [Unity] -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Unity.2D.Tilemap.Editor.dll
    3. 18: [Unity] error CS1704: An assembly with the same simple name 'Facebook.Unity.Settings' has already been imported. Try removing one of the references (e.g. '/UNITY_PATH/Unity/Unity-2019_2_0f1/PlaybackEngines/Facebook/SDK/7.9.4/Facebook.Unity.Settings.dll') or sign them to enable side-by-side.
    4. 19: [Unity] error CS1704: An assembly with the same simple name 'Facebook.Unity' has already been imported. Try removing one of the references (e.g. '/UNITY_PATH/Unity/Unity-2019_2_0f1/PlaybackEngines/Facebook/SDK/7.9.4/Facebook.Unity.dll') or sign them to enable side-by-side.
    This is not the real issue I think its probably something like this.
    1. 17276: [Unity] Assembly 'Assets/FacebookSDK/Plugins/Facebook.Unity.dll' will not be loaded due to errors:
    2. 17277: [Unity] Unable to resolve reference 'UnityEngine.UI'. Is the assembly missing or incompatible with the current platform?
    Check your full log.
    I think its the facebook SDK I'm going to try now a new project just with the latest SDK in it and run it through cloud build

    The issue is already being discussed here https://forum.unity.com/threads/ui.673504/
     
    wbd_lludo and marauderkr like this.
  42. chadq

    chadq

    Joined:
    Dec 24, 2017
    Posts:
    3
    I'm having the same issue with my project after a 2019.2 update, even after a clean build and update to Facebook SDK 7.17.2. Has anyone else had any luck with this?
     
    marauderkr likes this.
  43. studentutu

    studentutu

    Joined:
    Oct 22, 2017
    Posts:
    121
    Same issue with Cloud build on IOS and Android! Unity 2019.2.0f1 with Facebook SDK 7.17.1/7.17.2!
     
  44. studentutu

    studentutu

    Joined:
    Oct 22, 2017
    Posts:
    121
     
  45. michael_looply

    michael_looply

    Joined:
    Mar 26, 2018
    Posts:
    5
    For others facing this issue:

    Code (CSharp):
    1. 17276: [Unity] Assembly 'Assets/FacebookSDK/Plugins/Facebook.Unity.dll' will not be loaded due to errors:
    2. 17277: [Unity] Unable to resolve reference 'UnityEngine.UI'. Is the assembly missing or incompatible with the current platform?
    Can be circumvented by turning off reference validation in DLL import settings.

    There's another issue with Cloud Build compiling against both the 7.9.4 SDK and any SDK in the Assets directory that I've outlined here: https://forum.unity.com/threads/del...support-unity-2019-2-0f1.727052/#post-4852568

    Building locally is still possible as long as the Facebook Playback Engine is not installed for your local instance of the 2019.2.0f1 editor.
     
    chadq likes this.
  46. Alexhator

    Alexhator

    Joined:
    May 23, 2019
    Posts:
    2
    Sorry, but... what should I do? I am a bit new on this. Please, explain a little more.