Live player keeps disconnecting amongst many other problems

Hi

First off I cannot post a screenshot as this site wont allow me to yet so I will try to explain this particular error.

I had so many problems trying to run xamarin forms in visual studio, with emulator hanging that I have reinstalled windows completely and now have a fresh Windows 8.1 Pro machine 8gb ram, 2.4ghz intel i7, so those are the specs. Visual Studio Pro is a new download also.

I was using the live player on my phone up until ten minutes ago and it has stopped working. My solution builds and the solution is tiny, it is the beginning of a tutorial on plural sight.

My phone states: Waiting for visual Studio
you can now open visual studio and start your app on target Huaweixxxxx

I hit run in visual studio with the phone selected

next thing my phone says unable to connet, literally the moment I hit the run button and I get this message in visual studio

Start (WorkingDemoLayout.Android, HUAWEI PLK-L01 Player, ).
Attempting connection to debug address: 0.0.0.0:37847.
Attempting connection to debug address: 0.0.0.0:37847.
Attempting connection to debug address: 0.0.0.0:37847.
Attempting connection to debug address: 0.0.0.0:37847.
Attempting connection to debug address: 0.0.0.0:37847.
Unable to deploy to HUAWEI PLK-L01 Player, please ensure the Xamarin Live Player app is open and the device is on the same network as Visual Studio.
Failed to debug your app.

I have one emulator loaded. I try that, it worked an hour ago and now all it does it opens up and does not change from the emulator opening screen to my application, I could leave it there all day and nothing will happen. This is why I resorted to getting a nice clean windows and yet that issue is still there.

The xamarin Live worked and then just stopped, same as the emulator.

I have also had issue whereby errors come up on the build but these errors do not exist because it built 5 minutes previously and with absolutely no code, xaml or whatever changed it wont build any more.

I have just managed to see a partial error on my phone, "specified cast unable to" that was about all it showed, this was similar to a build error that came up in VS earlier but like I say I have not changed code or anything of the sort and to top it off it builds now in VS.

Is there anything I can do? I have been 5 days trying to get past the first part of a tutorial and all I seem to have done is try to fix issues with xamarin or visual studio.

I just can't believe it can be this difficult.

Any suggestions would be highly appreciated.

Many thanks

Paul

Best Answer

  • syvers147syvers147 ✭✭
    Accepted Answer

    I was just about to give up on xamarin......I still might do as I think learning Java would be quicker and more beneficial, when I thought lets just start deleting stuff and adding it back in. It eventually ran so I started putting xaml back that I had removed and this is the xaml that i removed and put back in one chunk and where the error was:

        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"></RowDefinition>"
                <RowDefinition Height="2*"></RowDefinition>
                <RowDefinition Height="100"></RowDefinition>
            </Grid.RowDefinitions>
    
    
        </Grid>
    

    The 7th line down has a double quote in it. I must have keyed it in somehow without realising as it had worked before.

    So, it would seem that error messages in xamarin/visual studio are a complete waste of time looking at and you need to go back to the old days of relying on your eyes rather than the IDE to tell you what is wrong.

    I am left with questions, if anyone could give some thoughts:

    What if my application was huge and someone inadvertently broke a line of xaml, it would be an absolute nightmare to find unless you were maybe using a repository and were able to check for changes against previous code?

    Is this an issue with any xaml? For instance I have not used WPF much but are there problems like this in there whereby the IDE cannot tell you when there is a XAML problem it just gives a generic and pointless error message?

    Would resharper have told me about this?

    Do I have my IDE configured incorrectly and I should have seen the double quote in Red to highlight it was wrong?

    Many thanks

    Paul

Answers

  • syvers147syvers147 Member ✭✭

    I have been getting this error now, still cant run anything:

    Start (WorkingDemoLayout.Android, HUAWEI PLK-L01 Player, ).
    Attempting connection to debug address: 192.168.1.107:37847.
    Connected to: 192.168.1.107:37847.
    Deploying C:\Xamarin Projects\WorkingDemoLayout\WorkingDemoLayout\WorkingDemoLayout.Android\WorkingDemoLayout.Android.csproj...
    Got device info: HUAWEI PLK-L01 Player (Android) @ 192.168.1.107:37847
    Synchronizing files...
    Building and running...
    Built with 4 messages.
    (1,1): error: Specified cast is not valid.
    (1,1): error: Specified cast is not valid.
    (1,1): error: Dependent project WorkingDemoLayout.csproj failed to build, using old version.
    C:\Xamarin Projects\WorkingDemoLayout\WorkingDemoLayout\WorkingDemoLayout.Android\MainActivity.cs(1,1): error: The type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?)
    Failed to debug your app.

    I found this on StackOverflow (cant post a link still)

    This is an issue that still exists. While this may not have been the solution back in July, this is the working solution for 3/31/16.

    Clean the solution
    Build the PCL
    Remove the PCL reference from the affected project(s)
    Re-add the PCL reference
    Build

    This also happens sometimes after opening a XAML file and switching back to a C# file in the PCL project.

    An hour later and still getting nowwhere

    This is the code from mainactivity


    using System;
    using Android.App;
    using Android.Content.PM;
    using Android.Runtime;
    using Android.Views;
    using Android.Widget;
    using Android.OS;

    namespace WorkingDemoLayout.Droid
    {
    [Activity(Label = "WorkingDemoLayout", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
    protected override void OnCreate(Bundle bundle)
    {
    TabLayoutResource = Resource.Layout.Tabbar;
    ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(bundle);
    
            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());
        }
    }
    

    }

    The App() code is in green which on my setup says that it is found.

    I have tried adding a using statement using WorkingDemoLayout

    I have tried the fully qualified name WorkingDemoLayout.App()

    I am about to try rebooting.

  • syvers147syvers147 Member ✭✭

    And that didn't fix anything either.

  • syvers147syvers147 Member ✭✭
    Accepted Answer

    I was just about to give up on xamarin......I still might do as I think learning Java would be quicker and more beneficial, when I thought lets just start deleting stuff and adding it back in. It eventually ran so I started putting xaml back that I had removed and this is the xaml that i removed and put back in one chunk and where the error was:

        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"></RowDefinition>"
                <RowDefinition Height="2*"></RowDefinition>
                <RowDefinition Height="100"></RowDefinition>
            </Grid.RowDefinitions>
    
    
        </Grid>
    

    The 7th line down has a double quote in it. I must have keyed it in somehow without realising as it had worked before.

    So, it would seem that error messages in xamarin/visual studio are a complete waste of time looking at and you need to go back to the old days of relying on your eyes rather than the IDE to tell you what is wrong.

    I am left with questions, if anyone could give some thoughts:

    What if my application was huge and someone inadvertently broke a line of xaml, it would be an absolute nightmare to find unless you were maybe using a repository and were able to check for changes against previous code?

    Is this an issue with any xaml? For instance I have not used WPF much but are there problems like this in there whereby the IDE cannot tell you when there is a XAML problem it just gives a generic and pointless error message?

    Would resharper have told me about this?

    Do I have my IDE configured incorrectly and I should have seen the double quote in Red to highlight it was wrong?

    Many thanks

    Paul

  • syvers147syvers147 Member ✭✭

    OMG...here is another final thought....

    I just tried it in the emulator as it was now working on my phone.

    The emulator was not working. I then tried it on my phone. That did not work. Would you believe what had reappeared in my code........the mysterious double quote was back!

    I deleted it again, phone is now working, but emulator just does nothing again.

  • syvers147syvers147 Member ✭✭

    Emulator is running again. I have no words left.

Sign In or Register to comment.