0

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

Geo
  • 31
  • 6

2 Answers2

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.

Community
  • 1
  • 1
Geo
  • 31
  • 6
0

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.

Sven-Michael Stübe
  • 14,560
  • 4
  • 52
  • 103
  • Thank you for your answer! I installed the PCL Package and after that i can't compile the project at all. Even on WP. There are many new errors in the MainActivity.cs file generated by the Xamarin template... I've also tried to add the reference to the Box2D DLL only but i get an error when compiling: _package android.support.v4.view.ViewPager does not exist_ – Geo Apr 27 '16 at 17:27
  • Hmm weird. Wich component have you used for WP that contained Box2D? – Sven-Michael Stübe Apr 27 '16 at 17:39
  • Not sure about what do you mean with "component" (I'm a newbie this stuff) but i downloaded the xamarin package and i'm using cocossharp 1.7.10 wich should actually contain Box2D – Geo Apr 27 '16 at 17:51