Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android debugger error (MonoDroid)

I'm developping an Android app in Visual Studio 2010 with MonoDroid. I'm already pretty far and was able to run and debug my app on the emulator aswell as a Android device. For some reason my Visual Studio is not debugging the app properly to my device anymore. The error i (sometimes) get is:


Microsoft Visual Studio

The application could not be started. Ensure that the application has been installed to the target device and has a launchable activity (MainLauncher = true).

Additionally, check Build->Configuration Manager to ensure this project is set to Deploy for this configuration.

OK

(ALL of the solutions above I've already checked..)

Other times there is no error at all and Visual Studio just stops running or the app starts fine but visual studio is non responsive.

The error just started recently while (almost) nothing has changed on the application. I was hoping someone had this error before and knew if it was because of some property setting or something?

PS: I also believe it could be caused by my camera, I use it in my app and when my app decides to deploy (~1 in 5 times) it crashed on the camera screen, here's the cameracode:

    private void CreateCamera(ISurfaceHolder holder)
    {
        try
        {
            if (holder != null)
            {
                camera = Android.Hardware.Camera.Open();
                Android.Hardware.Camera.Parameters p = camera.GetParameters();
                p.PictureFormat = ImageFormatType.Jpeg;
                camera.SetParameters(p);
                camera.SetDisplayOrientation(90);
                camera.SetPreviewCallback(this);
                camera.Lock();
                camera.SetPreviewDisplay(holder);
                camera.StartPreview();

                if (PackageManager.HasSystemFeature("android.hardware.camera.autofocus"))
                {
                    camera.AutoFocus(this);
                }
            }
        }
        catch (System.Exception e)
        {
            Android.Util.Log.Debug("SIMPLECAMERA", e.Message);
            System.Console.WriteLine(e.Message);
        }
    }
like image 288
Lieketjj Avatar asked Sep 05 '12 12:09

Lieketjj


2 Answers

In Visual Studio 2010: Build -> Configuration Manager -> Put a check in the "Deploy" box.

This happened to me when I changed from Debug configuration to Release. For some reason, the Deploy box remained unselected.

like image 137
YarsRevenge13 Avatar answered Oct 19 '22 16:10

YarsRevenge13


For me, I had the Deploy checkbox ticked all along but found the trick if you're targeting "Any CPU" for emulators is to explicitly target x86.

I'm running a 32 bit PC and the x86 platform setting is in the Configuration Manager:

enter image description here

enter image description here

enter image description here

First time you run the app it takes a few minutes (to install platform framework and etc).

Edit: I just found the official documentation, some issue with ARM based architecture and x86 being the way to go

like image 27
Jeremy Thompson Avatar answered Oct 19 '22 16:10

Jeremy Thompson