Reputation: 23
I've just bought the "YouTube Mobile Video Player" plugin on Unity's asset store, but when I import the plugin I just get this error, that obliges me to remove the plugin from my project.
I get the following error while importing :
Unhandled Exception: System.TypeLoadException: Could not load type 'Newtonsoft.Json.Linq.JObject' from assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.
Newtonsoft.Json is a dependency of the YouTube plugin, so I can't run it without the DLL.
I tried downloading several versions of Newtonsoft.Json on their website but i can't get rid of the TypeLoadException.
I'm using Unity3D 5.2.3f1 on Linux but I don't think that is the problem.
Link for the plugin : https://www.assetstore.unity3d.com/en/#!/content/29704 Link for Newtonsoft.Json : http://www.newtonsoft.com/json
Can someone help me to get rid of that exception?
EDIT : If I try to import the plugin into a blank project, i get that error
Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in :0
at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in :0
at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in :0
at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in :0
at Mono.CSharp.Driver.LoadReferences () [0x00000] in :0
at Mono.CSharp.Driver.Compile () [0x00000] in :0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in :0
The class System.ComponentModel.INotifyPropertyChanging could not be loaded, used in System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
The class System.ComponentModel.AddingNewEventHandler could not be loaded, used in System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
The class JTokenReferenceEqualityComparer could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JContainer could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JObject could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JContainer could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JContainer could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JContainer could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class Newtonsoft.Json.Linq.JObject could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class d__4`2 could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class d__f`2 could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class d__0 could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class d__2 could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
The class c__DisplayClass2 could not be loaded, used in Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
Upvotes: 1
Views: 4182
Reputation: 1461
Assuming that your package already includes the correct DLL files and that you put them into the Plugins folder, you can also check Project Settings -> Other Settings -> Api Compatibility Level and set it to .Net 2.0 Full. If you can, try it on Windows, Unity on Linux might still have problems, but generally if it's on the asset store, it should be compatible.
Upvotes: 1
Reputation: 929
Is the solution (VS or monodevelop) need to have this DLL referenced at all? You might need to do more than just drop the DLL in the asset folder.
Look here,
http://docs.unity3d.com/Manual/UsingDLL.html
Make sure everything looks right. Unfortunately I've never ran into this problem with 3rd party dlls. You might need to do this (copy pasted from link)
Setting Up a Debugging Session for the DLL
Firstly, you should prepare the debug symbols for the DLL. In MonoDevelop, copy the built file /bin/Debug/DLLTest.dll.mdb into the Assets/Plugins folder. In Visual Studio, execute
Program Files\Unity\Editor\Data\Mono\lib\mono\2.0\pdb2mdb.exe in the command prompt, passing \bin\Debug\DLLTest.pdb as a parameter. Then, copy the converted file \bin\Debug\DLLTest.dll.mdb into Assets/Plugins
Hope this helps and good luck
Upvotes: 0