System.MissingMethodException: Method 'CCLayerColor..ctor' not found

Hello,

i am currently getting this exception whenever i try to create a CCLayerColor; even just a plain CCLayerColor.

07-04 20:24:52.842 I/MonoDroid( 1876): UNHANDLED EXCEPTION:
07-04 20:24:52.862 I/MonoDroid( 1876): System.MissingMethodException: Method 'CCLayerColor..ctor' not found.
07-04 20:24:52.862 I/MonoDroid( 1876): at App1.MainMenu..ctor (CocosSharp.CCWindow) [0x00009] in c:\Users\kevin\Documents\Visual Studio 2013\Projects\CCTest\App1\App1\MainMenu.cs:21
07-04 20:24:52.862 I/MonoDroid( 1876): at App1.Delegate.ApplicationDidFinishLaunching (CocosSharp.CCApplication,CocosSharp.CCWindow) [0x0002a] in c:\Users\kevin\Documents\Visual Studio 2013\Projects\CCTest\App1\App1\Delegate.cs:32
07-04 20:24:52.862 I/MonoDroid( 1876): at CocosSharp.CCApplication.LoadContent ()
07-04 20:24:52.862 I/MonoDroid( 1876): at Microsoft.Xna.Framework.DrawableGameComponent.Initialize ()
07-04 20:24:52.862 I/MonoDroid( 1876): at CocosSharp.CCApplication.Initialize ()
07-04 20:24:52.862 I/MonoDroid( 1876): at Microsoft.Xna.Framework.Game.InitializeExistingComponents ()
07-04 20:24:52.862 I/MonoDroid( 1876): at Microsoft.Xna.Framework.Game.Initialize ()
07-04 20:24:52.862 I/MonoDroid( 1876): at Microsoft.Xna.Framework.Game.DoInitialize ()
07-04 20:24:52.862 I/MonoDroid( 1876): at Microsoft.Xna.Framework.AndroidGamePlatform.BeforeUpdate (Microsoft.Xna.Framework.GameTime)
07-04 20:24:52.862 I/MonoDroid( 1876): at Microsoft.Xna.Framework.Game.DoUpdate (Microsoft.Xna.Framework.GameTime)
07-04 20:24:52.862 I/MonoDroid( 1876): at Microsoft.Xna.Framework.Game.Tick ()
07-04 20:24:52.862 I/MonoDroid( 1876): at Microsoft.Xna.Framework.AndroidGameWindow.OnUpdateFrame (object,OpenTK.FrameEventArgs)
07-04 20:24:52.862 I/MonoDroid( 1876): at OpenTK.GameViewBase.OnUpdateFrame (OpenTK.FrameEventArgs) [0x00014] in /Users/builder/data/lanes/1879/5f55a9ef/source/opentk/Source/OpenTK/Platform/Android/GameViewBase.cs:313
07-04 20:24:52.862 I/MonoDroid( 1876): at OpenTK.Platform.Android.AndroidGameView.UpdateFrameInternal (OpenTK.FrameEventArgs) [0x00013] in /Users/builder/data/lanes/1879/5f55a9ef/source/opentk/Source/OpenTK/Platform/Android/AndroidGameView.cs:349
07-04 20:24:52.862 I/MonoDroid( 1876): at OpenTK.Platform.Android.AndroidGameView.RunIteration (System.Threading.CancellationToken) [0x00096] in /Users/builder/data/lanes/1879/5f55a9ef/source/opentk/Source/OpenTK/Platform/Android/AndroidGameView.cs:569
07-04 20:24:52.862 I/MonoDroid( 1876): at OpenTK.Platform.Android.AndroidGameView/c__AnonStorey0.<>m__0 (object) [0x0000d] in /Users/builder/data/lanes/1879/5f55a9ef/source/opentk/Source/OpenTK/Platform/Android/AndroidGameView.cs:459
07-04 20:24:52.862 I/MonoDroid( 1876): at Android.App.SyncContext/c__AnonStorey1.<>m__0 () [0x00000] in /Users/builder/data/lanes/1879/5f55a9ef/source/monodroid/src/Mono.Android/src/Android.App/SyncContext.cs:32
07-04 20:24:52.862 I/MonoDroid( 1876): at Java.Lang.Thread/RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/1879/5f55a9ef/source/monodroid/src/Mono.Android/src/Java.Lang/Thread.cs:36
07-04 20:24:52.862 I/MonoDroid( 1876): at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) [0x00009] in /Users/builder/data/lanes/1879/5f55a9ef/source/monodroid/src/Mono.Android/platforms/android-10/src/generated/Java.Lang.IRunnable.cs:71
07-04 20:24:52.862 I/MonoDroid( 1876): at (wrapper dynamic-method) object.fd163889-230e-47e0-b9a9-2363a12996ef (intptr,intptr)
07-04 20:24:52.882 D/AndroidRuntime( 1876): Shutting down VM
07-04 20:24:52.886 W/dalvikvm( 1876): threadid=1: thread exiting with uncaught exception (group=0xa4dd7b20)
An unhandled exception occured.

Posts

  • kjpou1kjpou1 LUMember, Xamarin Team Xamurai

    @kevinheyer

    Is this with version 1.5.0.1 of CocosSharp? Could you please attach a small sample project that demonstrates this error.

  • kevinheyerkevinheyer CAMember

    @kjpou1

    Sorry, yes this is with 1.5.0.1. Also im not sure if im doing something inherently wrong, and this plc is run using a android emulator.

    public class Delegate:CCApplicationDelegate
    {
    public override void ApplicationDidFinishLaunching(CCApplication app, CCWindow window)
    {
    app.PreferMultiSampling = false;
    app.ContentRootDirectory = "Content";
    app.ContentSearchPaths.Add("hd");

            CCScene scene = new CCScene(window);
            CCLayerColor layer = new CCLayerColor();
            var label = new CCLabel("Tap Screen To Play!","MarkerFelt-22" , 22)
            {
                Position = layer.VisibleBoundsWorldspace.Center,
                Color = CCColor3B.Black,
                HorizontalAlignment = CCTextAlignment.Center,
                VerticalAlignment = CCVerticalTextAlignment.Center,
                AnchorPoint = CCPoint.AnchorLowerLeft,
                Dimensions = layer.ContentSize
            };
            layer.AddChild(label);
            scene.AddChild(layer);
            window.RunWithScene(scene);
        }
    }
    
  • kjpou1kjpou1 LUMember, Xamarin Team Xamurai

    @kevinheyer

    I just created a new cross platform PCL project from the templates.

    Pasted the code:

        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
    
            application.PreferMultiSampling = false;
            application.ContentRootDirectory = "Content";
            application.ContentSearchPaths.Add("animations");
            application.ContentSearchPaths.Add("fonts");
            application.ContentSearchPaths.Add("sounds");
    
            CCScene scene = new CCScene(mainWindow);
            CCLayerColor layer = new CCLayerColor();
            var label = new CCLabel("Tap Screen To Play!","arial" , 22)
                {
                    Position = layer.VisibleBoundsWorldspace.Center,
                    Color = CCColor3B.Black,
                    HorizontalAlignment = CCTextAlignment.Center,
                    VerticalAlignment = CCVerticalTextAlignment.Center,
                    AnchorPoint = CCPoint.AnchorLowerLeft,
                    Dimensions = layer.ContentSize
                };
            layer.AddChild(label);
            scene.AddChild(layer);
    
            mainWindow.RunWithScene(scene);
        }
    

    Everything worked on my end.

    Could you please attach a small sample project that demonstrates this error.

  • kjpou1kjpou1 LUMember, Xamarin Team Xamurai
    edited July 2015

    That is just a project and it looks like it is a Portable project only. We would need the full solution to see what is going on.

    Although, before doing that install the VS templates. Create a new project solution from the template CocosSharp -> Mobile -> Portable. This will create a portable project for Android, iOS and Windows Phone 8.1. This has an example of a CCLayerColor.

    I just did that and it runs with no problem.

Sign In or Register to comment.