“Type or namespace Box2D could not be found” on Android (Xamarin/CocosSharp)

左心房为你撑大大i 提交于 2019-12-25 06:20:39

问题


Im building a simple game with Xamarin/Cocossharp in a Shared Project. I added some physics with Box2D and everything works well on WP8.1.

I import Box2D and i access to the methods and class provided without problem on Windows Phone, but when i try to compile it for Android it says that the type or namespace "Box2D" could not be found. Intellisense doesn't shows any error...

error output

I'm new to game dev and also to VS2015 so it may be something simple but i dont understand what I'm missing here.

Thanks in advance


回答1:


After struggling around with this i managed to fix this:

As pointed out from Sven-Michael in his answer the solution was to install:

CocosSharp.PCL.Shared 

from NuGet. In my case was only necessary to add the reference to the Box2D.DLL file contained into the package.

The reason why it was not working for me it's probably that because of trying to solve this problem I've messed up whit my solution and caused other problems. So I created a new Project from skratch and I've imported my source code again.




回答2:


Ensure that you have installed CocosSharp.PCL.Shared to your Android project.

E.g. via PM-Comsole:

 Install-Package CocosSharp.PCL.Shared

But it can be installed via NuGet, too. This will add box2d and some other dependencies automatically.



来源:https://stackoverflow.com/questions/36877705/type-or-namespace-box2d-could-not-be-found-on-android-xamarin-cocossharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!