Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

Microsoft.Azure.Mobile.Client PullAsync “unexpected character encountered while parsing value..."

$
0
0

I am using Microsoft.Azure.Mobile.Client to perform offline synchronization. For now I have been able to perform synchronization in problems with a couple of tables both in the synchronization up and in the synchronization down. But I have the problem that one of the tables at the time of synchronization down throws the expectation (Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.).

Could it be some special character that this content within my data? or some configuration problem? This table has 2600 records that I am trying to download, could it be for the amount?

public async Task SyncAllAsync(bool SyncForce = false)
       {

           ReadOnlyCollection<MobileServiceTableOperationError> syncErrors = null;
           long PendingChanges = CurrentClient.SyncContext.PendingOperations;
           try
           {
               await CurrentClient.SyncContext.PushAsync();

               await AnalityTable.PullAsync("SyncAnalityAsync", AnalityTable.CreateQuery());

               await DiseasesTable.PullAsync("SyncDiseasesAsync", DiseasesTable.CreateQuery());


           }
           catch (MobileServicePushFailedException exc)
           {
               if (exc.PushResult != null)
               {
                   syncErrors = exc.PushResult.Errors;
               }
           }

           // Simple error/conflict handling. A real application would handle the various errors like network conditions,
           // server conflicts and others via the IMobileServiceSyncHandler.
           if (syncErrors != null)
           {
               foreach (MobileServiceTableOperationError error in syncErrors)
               {
                   if (error.OperationKind == MobileServiceTableOperationKind.Update && error.Result != null)
                   {
                       //Update failed, reverting to server's copy.
                       await error.CancelAndUpdateItemAsync(error.Result);
                   }
                   else
                   {
                       // Discard local change.
                       await error.CancelAndDiscardItemAsync();
                   }

                   string message = "Error executing sync operation. Item: " + error.TableName + " (" + error.Item["id"] + "). Operation discarded.";

                   Debug.WriteLine(message);
               }
           }
       }

SelectedIndex for CardView

$
0
0

Hi everyone !

I use CardView Plugin in my application.

When the user clicks on any of the cards, I want to go to that card's detail page. Since there is a dynamically variable number of cards, I want to get the index of the card that the user clicks on. Because I have to show the details of the selected card on the detail page.

I tried to do that, but I couldn't find the solution. However, there is a variable called position in the plugin documentation. I think I should solve my problem with this.

cs.Side

    void selectedCollection(object sender, EventArgs args)
    {
        var item = model[1];
                Navigation.PushAsync(new DlAnayasaPage(item.CampaignName,item.CampaignPicture));
    }

For example, when I clicked on the image using a GestureRecognizer, I said go to the detail page. Everything is very beautiful. But I couldn't use the dynamic position instead of the number 1 here.(model[1])

How can i solved ?

unexpected character encountered while parsing value , when linker properties set sdk linking only.

$
0
0

unexpected character encountered while parsing value path line 0 position 0 source , when linker properties set sdk linking only. its works fine during json parsing when linking set to none. why its come please help in this regards.

Xamarin grid column auto width but max possible?

$
0
0

Hi,
I set ColumnDefinition Width="Auto" in in XAML.
This is fine, but I would like to restrict the max size of the column.
So till that point it's Auto, after that no more expanding width.
Is this possible?
Thanks

CancellationToken.ThrowOperationCanceledException

$
0
0

I am getting the following error on my Xamarin.Forms project:

{System.OperationCanceledException: The operation was canceled.
at System.Threading.CancellationToken.ThrowOperationCanceledException () [0x00010] in <46c2fa109b574c7ea6739f9fe2350976>:0
at System.Threading.CancellationToken.ThrowIfCancellationRequested () [0x00008] in <46c2fa109b574c7ea6739f9fe2350976>:0
at Xamarin.Android.Net.AndroidClientHandler+<>c__DisplayClass44_0.b__0 () [0x0004f] in /Users/vsts/agent/2.155.1/work/1/s/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.cs:343
at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <46c2fa109b574c7ea6739f9fe2350976>:0
at System.Threading.Tasks.Task.Execute () [0x00000] in <46c2fa109b574c7ea6739f9fe2350976>:0
--- End of stack trace from previous location where exception was thrown ---

at Xamarin.Android.Net.AndroidClientHandler.DoProcessRequest (System.Net.Http.HttpRequestMessage request, Java.Net.URL javaUrl, Java.Net.HttpURLConnection httpConnection, System.Threading.CancellationToken cancellationToken, Xamarin.Android.Net.AndroidClientHandler+RequestRedirectionState redirectState) [0x000e4] in /Users/vsts/agent/2.155.1/work/1/s/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.cs:393
at Xamarin.Android.Net.AndroidClientHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00285] in /Users/vsts/agent/2.155.1/work/1/s/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.cs:286
at System.Net.Http.HttpClient.FinishSendAsyncBuffered (System.Threading.Tasks.Task`1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean disposeCts) [0x0017e] in <814c177e4f174da89876fafdde15d02e>:0
at BUCOLogin.Constants.RestService.GetBranchesAsync (System.String uri) [0x00046] in C:\Visual Studio Training\BUCO FR Login\FacialRecognitionLogin\Constants\RestService.cs:18 }

After some investigation it seems that a token is being cancelled, but I'm not sure where this token is located or even why its being cancelled. I am using an open API request with no APIKey needed :

Constants.cs:

using System;
using System.Collections.Generic;
using System.Text;

namespace BUCOLogin.Constants
{
public static class Constants
{
public const string OpenBabbageEndpoint = "HTTP-LINK";
//public const string OpenBabbageAPIKey = "f6a04a6c3fbc534c295f6a5e8548e0f6";
}
}

When stepping through code, it stalls/waits for a while at the following code before giving me the exception:

HttpResponseMessage response = await _client.Value.GetAsync(uri);

This code is located in RestService.cs:

using System;
using System.Diagnostics;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace BUCOLogin.Constants
{
public class RestService
{
static Lazy _client = new Lazy(() => new HttpClient());

    public async Task<GetBranches> GetBranchesAsync(string uri)
    {
        GetBranches branchesData = null;
        try
        {
            HttpResponseMessage response = await _client.Value.GetAsync(uri);
            if (response.IsSuccessStatusCode)
            {
                string content = await response.Content.ReadAsStringAsync();
                branchesData = JsonConvert.DeserializeObject<GetBranches>(content);
            }
        }
        catch (Exception ex)
        {
            Debug.WriteLine("\tERROR {0}", ex.Message);
        }

        return branchesData;
    }
}

}

GetBranches.cs:

using System;
using System.Collections.Generic;
using System.Text;

using Newtonsoft.Json;

namespace BUCOLogin.Constants
{
public class GetBranches
{

    [JsonProperty("name")]
    public string Name { get; set; }

    [JsonProperty("number")]
    public string Number { get; set; }

    [JsonProperty("postcode")]
    public string Postcode { get; set; }

    [JsonProperty("manager")]
    public string Manager { get; set; }

    [JsonProperty("phone")]
    public string Phone { get; set; }

    [JsonProperty("address")]
    public string Address { get; set; }

    [JsonProperty("open")]
    public string Open { get; set; }

    [JsonProperty("close")]
    public string Close { get; set; }

    [JsonProperty("opensat")]
    public string Opensat { get; set; }

    [JsonProperty("closesat")]
    public string Closesat { get; set; }

}

}

The uri Request does bring back multiple results on Postman so I am not sure why I am getting this exception and how to move forward.

Thanks in advance.

CancellationToken.ThrowOperationCanceledException

$
0
0

I am getting the following error on my Xamarin.Forms project:

{System.OperationCanceledException: The operation was canceled.
at System.Threading.CancellationToken.ThrowOperationCanceledException () [0x00010] in <46c2fa109b574c7ea6739f9fe2350976>:0
at System.Threading.CancellationToken.ThrowIfCancellationRequested () [0x00008] in <46c2fa109b574c7ea6739f9fe2350976>:0
at Xamarin.Android.Net.AndroidClientHandler+<>c__DisplayClass44_0.b__0 () [0x0004f] in /Users/vsts/agent/2.155.1/work/1/s/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.cs:343
at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <46c2fa109b574c7ea6739f9fe2350976>:0
at System.Threading.Tasks.Task.Execute () [0x00000] in <46c2fa109b574c7ea6739f9fe2350976>:0
--- End of stack trace from previous location where exception was thrown ---

at Xamarin.Android.Net.AndroidClientHandler.DoProcessRequest (System.Net.Http.HttpRequestMessage request, Java.Net.URL javaUrl, Java.Net.HttpURLConnection httpConnection, System.Threading.CancellationToken cancellationToken, Xamarin.Android.Net.AndroidClientHandler+RequestRedirectionState redirectState) [0x000e4] in /Users/vsts/agent/2.155.1/work/1/s/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.cs:393
at Xamarin.Android.Net.AndroidClientHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00285] in /Users/vsts/agent/2.155.1/work/1/s/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.cs:286
at System.Net.Http.HttpClient.FinishSendAsyncBuffered (System.Threading.Tasks.Task`1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean disposeCts) [0x0017e] in <814c177e4f174da89876fafdde15d02e>:0
at BUCOLogin.Constants.RestService.GetBranchesAsync (System.String uri) [0x00046] in C:\Visual Studio Training\BUCO FR Login\FacialRecognitionLogin\Constants\RestService.cs:18 }

After some investigation it seems that a token is being cancelled, but I'm not sure where this token is located or even why its being cancelled. I am using an open API request with no APIKey needed :

Constants.cs:

using System;
using System.Collections.Generic;
using System.Text;

namespace BUCOLogin.Constants
{
public static class Constants
{
public const string OpenBabbageEndpoint = "HTTP-LINK";
//public const string OpenBabbageAPIKey = "f6a04a6c3fbc534c295f6a5e8548e0f6";
}
}

When stepping through code, it stalls/waits for a while at the following code before giving me the exception:

HttpResponseMessage response = await _client.Value.GetAsync(uri);

This code is located in RestService.cs:

using System;
using System.Diagnostics;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace BUCOLogin.Constants
{
public class RestService
{
static Lazy _client = new Lazy(() => new HttpClient());

    public async Task<GetBranches> GetBranchesAsync(string uri)
    {
        GetBranches branchesData = null;
        try
        {
            HttpResponseMessage response = await _client.Value.GetAsync(uri);
            if (response.IsSuccessStatusCode)
            {
                string content = await response.Content.ReadAsStringAsync();
                branchesData = JsonConvert.DeserializeObject<GetBranches>(content);
            }
        }
        catch (Exception ex)
        {
            Debug.WriteLine("\tERROR {0}", ex.Message);
        }

        return branchesData;
    }
}

}

GetBranches.cs:

using System;
using System.Collections.Generic;
using System.Text;

using Newtonsoft.Json;

namespace BUCOLogin.Constants
{
public class GetBranches
{

    [JsonProperty("name")]
    public string Name { get; set; }

    [JsonProperty("number")]
    public string Number { get; set; }

    [JsonProperty("postcode")]
    public string Postcode { get; set; }

    [JsonProperty("manager")]
    public string Manager { get; set; }

    [JsonProperty("phone")]
    public string Phone { get; set; }

    [JsonProperty("address")]
    public string Address { get; set; }

    [JsonProperty("open")]
    public string Open { get; set; }

    [JsonProperty("close")]
    public string Close { get; set; }

    [JsonProperty("opensat")]
    public string Opensat { get; set; }

    [JsonProperty("closesat")]
    public string Closesat { get; set; }

}

}

The uri Request does bring back multiple results on Postman so I am not sure why I am getting this exception and how to move forward.

Thanks in advance.

Print PDF file using Xamarin forms

$
0
0

Hello Developers

I am printing a Pdf file via print services.
I implemented some code but not working through a exception java.lang.RuntimeException: Cannot print a malformed PDF file
Please check my code and let me where i am wrong.

    public void Print(byte[] content)
    {
        //Android print code goes here
        Stream inputStream = new MemoryStream(content);
        string fileName = "form.pdf";
        if (inputStream.CanSeek)
        //Reset the position of PDF document stream to be printed
        inputStream.Position = 0;
        //Create a new file in the Personal folder with the given name
        string createdFilePath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), fileName);
        //Save the stream to the created file
        using (var dest = System.IO.File.OpenWrite(createdFilePath))
        inputStream.CopyTo(dest);
        string filePath = createdFilePath;
        PrintManager printManager = (PrintManager)Forms.Context.GetSystemService(Context.PrintService);
        PrintDocumentAdapter pda = new CustomPrintDocumentAdapter(filePath);
        //Print with null PrintAttributes
        printManager.Print(fileName, pda, null);
    }

This is my PrintDocumentAdapter

    internal class CustomPrintDocumentAdapter : PrintDocumentAdapter
    {
        private string filePath;
        public CustomPrintDocumentAdapter(string filePath)
        {
            this.filePath = filePath;
        }
        public override void OnLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes, CancellationSignal cancellationSignal, LayoutResultCallback callback, Bundle extras)
        {
            if (cancellationSignal.IsCanceled)
            {
                callback.OnLayoutCancelled();
                return;
            }
            callback.OnLayoutFinished(new PrintDocumentInfo.Builder(filePath)
            .SetContentType(PrintContentType.Document)
            .Build(), true);
        }

        public override void OnWrite(PageRange[] pages, ParcelFileDescriptor destination, CancellationSignal cancellationSignal, WriteResultCallback callback)
        {
            try
            {
                using (InputStream input = new FileInputStream(filePath))
                {
                    using (OutputStream output = new FileOutputStream(destination.FileDescriptor))
                    {
                        var buf = new byte[1024];
                        int bytesRead;
                        while ((bytesRead = input.Read(buf)) > 0)
                        {
                            output.Write(buf, 0, bytesRead);
                        }
                    }
                }
                callback.OnWriteFinished(new[] { PageRange.AllPages });
            }
            catch (FileNotFoundException fileNotFoundException)
            {
                System.Diagnostics.Debug.WriteLine(fileNotFoundException);
            }
            catch (Exception exception)
            {
                System.Diagnostics.Debug.WriteLine(exception);
            }
        }
    }

i am calling Print method in this way

    private void GoToPrintPage_Clicked(object sender, EventArgs e)
    {
        using (var webClient = new WebClient())
        {
            var url = "https://vector.me/files/images/1/7/17513/tottenham_hotspur_fc.png";
            var imageBytes = webClient.DownloadData(new Uri(url));
            DependencyService.Get<Interface.IWifiPrinterConnectivity>().Print(imageBytes);
        }
    }

How to create a NuGet using VS2019 for Android, iOS and UWP?

$
0
0

I have just been looking into packaging my printing code for Android, iOS and UWP as a NuGet. Astonishingly, the Microsoft documentation about how to create a NuGet for Xamarin.Forms dates back to VS2015 and bears no relation to current reality as far as I can see (or as far as any of the people who have commented on the documentation page in the last 18 months can see).

Does anybody know of a simple guide to creating a NuGet for Xamarin.Forms (for Android, iOS and UWP) using modern tooling?

(Needless to say, I've logged an issue in GitHub about the documentation)

[Edit: Found some other Microsoft pages, but they seem to assume the reader has a whole load of prior knowledge about related bits]

cc. @DavidBritch


Unable to Open PDF into the third-party app

$
0
0

Hi,

I am downloading file into download folder. A pdf file is downloaded properly but unable to open into third-party app.

  1. If I select Target SDK : Automatic into the droid then it works perfectly. I am able to show pdf file with the third-party app. But with this selection, I can't publish app on the play store. It throws an error Target SDK should be 23 or greater.

  2. If I select Target SDK other than automatic then it's not allowing to open PDF file into the third-party app.
    Please see my code below.

public void OpenFile(string filePath)
{
string externalStorageState = global::Android.OS.Environment.ExternalStorageState;
string application = "";

        string extension = System.IO.Path.GetExtension(filePath);

        switch (extension.ToLower())
        {
            case ".doc":
            case ".docx":
                application = "application/msword";
                break;
            case ".pdf":
                application = "application/pdf";
                break;
            case ".xls":
            case ".xlsx":
                application = "application/vnd.ms-excel";
                break;
            case ".jpg":
                application = "image/jpeg";
                break;
            case ".jpeg":
                application = "image/jpeg";
                break;
            case ".png":
                application = "image/png";
                break;
            default:
                application = "*/*";
                break;
        }
        //var externalPath = global::Android.OS.Environment.ExternalStorageDirectory.Path + "/report" + extension;
        //File.WriteAllBytes(externalPath, bytes);

        //Java.IO.File file = new Java.IO.File(externalPath);
        Java.IO.File file = new Java.IO.File(filePath);
        file.SetReadable(true);
        //Android.Net.Uri uri = Android.Net.Uri.Parse("file://" + filePath);
        Android.Net.Uri uri = Android.Net.Uri.FromFile(file);
        Intent intent = new Intent(Intent.ActionView);
        intent.SetDataAndType(uri, application);
        intent.SetFlags(ActivityFlags.ClearWhenTaskReset | ActivityFlags.NewTask);

        try
        {
            Xamarin.Forms.Forms.Context.StartActivity(intent);
        }
        catch (Exception)
        {
            Toast.MakeText(Xamarin.Forms.Forms.Context, "No Application Available to View this file.", ToastLength.Short).Show();
        }
    }

The code is crashing on this line Xamarin.Forms.Forms.Context.StartActivity(intent);

Please help me.

Can you bind the hamburger menu icon in android?

$
0
0

I would like to do something like:

        <MasterDetailPage.Master>
            <ContentPage Title="Menu" IconImageSource="{Binding MyIcon}" BackgroundColor="#454d58">

But in Android it does not work. Is there a way to achieve that?

How to take a screen shot using HardwareButton (Power + VolumeDown) PROGRAMATICALLY

Custom font getting cut off at bottom => UIFont????

$
0
0

Having an issue where a custom font (FontAwesome) is not rendering properly. The bottom is getting cut off, so for example you can't see the loop in a lowercase "g" and looks like a backwards "p".

From what it seems I can correct this with the ascender/descender ?

Anyone know how to use it???

Thanks!

Custom Fonts Being Cut Off

Convert GoogleMap Snapshot Java solution to Xamarin C#

Creating a Custom Control by Inheriting from Button

$
0
0

I am working on converting my apps from UWP to Xamarin. In my UWP apps, I had a custom control that inherited from Button. The control overrode and added several properties (including the Template property, which used my added properties using TemplateBinding). I have found information on how to inherit from ContentView in Xamarin, but I need the functionality & properties inherited from Button. How can I do something similar to create a custom Button in Xamarin? Thanks.


AppStore submissions crashing after upgrade.. how to downgrade Xamarin.Mac / Mono?

$
0
0

My latest AppStore submissions are getting rejected due to crashes at startup and I need to downgrade to isolate what is causing the crash.

My distribution build is working just fine but each AppStore submission is getting rejected due to a crash at startup. I can't see any obvious app code changes which could cause any crashes but I've just reverted all code changes to the last successful submission and resubmitted to eliminate any app code changes as a cause.

My next test will be to downgrade the framework versions to the last successfully submitted version and resubmit to see if it's something in there that is now causing the crash.

My latest successful submission was on 3rd October 2019 so I need to downgrade to Xamarin.Mac 6.2.0.42

However, I'm struggling to find how to downgrade....

1) Where can I find the Xamarin.Mac 6.2.0.42 package?
2) It doesn't look like the Mono Framework MDK was updated since 3rd October, is that right?
3) It also looks like I need to downgrade Xcode from 11.1 to 11.0 is that necessary if I'm downgrading Xamarin.Mac?

integrating amazon lex in xamarin app (ios and android)

$
0
0

hello,

i have xamarin app for ios and android platform and need to integrate Amazon Lex in to it.
i have created chatbot with identity pool with permission.
there is no proper solution exactly what to be done so that i can integrate chatbot into existing app.
please guide me on this.

integrating amazon lex in xamarin app (ios and android)

$
0
0

hello,

i have xamarin app for ios and android platform and need to integrate Amazon Lex in to it.
i have created chatbot with identity pool with permission.
there is no proper solution exactly what to be done so that i can integrate chatbot into existing app.
please guide me on this.

is not Working!

$
0
0

Here, <controls:CarouselViewControl.GestureRecognizers> is not working when it tap,

                                <controls:CarouselViewControl.GestureRecognizers>
                                    <TapGestureRecognizer NumberOfTapsRequired="1" Tapped="ItemTappedEvent">
                                    </TapGestureRecognizer>
                                </controls:CarouselViewControl.GestureRecognizers>

                                <controls:CarouselViewControl.ItemTemplate>
                                    <DataTemplate>
                                        <Label Text="{Binding ItemName}" Style="{StaticResource ItemHeading}"></Label>
                                    </DataTemplate>
                                </controls:CarouselViewControl.ItemTemplate>
                            </controls:CarouselViewControl>

Azure Devops: Android Forms app using Shell crashes when built by the Azure Pipeline

$
0
0

Note: This issue can be reproduced using the Shell app template.

I'm going to work around this issue by stripping out shells from my app. But am posting this as my search for the error isn't anywhere on the net and I can't believe nobody has run into this before.

I have a new Xamarin Forms app using the new Shell framework that I'm trying to get built by Azure Pipelines and deployed via Visual Studio App Center.

The iOS build is completely fine. And the Android build works running locally and even when locally built and manually uploaded to Visual Studio App Center. But when I build the Android app using Azure Pipelines, the app crashes on startup.

I've deduced that this is an issue with Shell vs Azure Pipelines since this issue even happens when I built a test app from the unmodified shell app template with .NET standard for the shared code.

This is the error logged by LogCat:

08-30 13:22:05.781 25813 25813 E AndroidRuntime: FATAL EXCEPTION: main
08-30 13:22:05.781 25813 25813 E AndroidRuntime: Process: au.com.sfi.testapp, PID: 25813
08-30 13:22:05.781 25813 25813 E AndroidRuntime: android.runtime.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at Xamarin.Forms.Platform.Android.ShellBottomNavViewAppearanceTracker.SetBackgroundColor (Android.Support.Design.Widget.BottomNavigationView bottomView, Xamarin.Forms.Color color) [0x00080] in :0
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at Xamarin.Forms.Platform.Android.ShellBottomNavViewAppearanceTracker.ResetAppearance (Android.Support.Design.Widget.BottomNavigationView bottomView) [0x00020] in :0
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at Xamarin.Forms.Platform.Android.ShellItemRenderer.ResetAppearance () [0x00000] in :0
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at Xamarin.Forms.Platform.Android.ShellItemRenderer.Xamarin.Forms.IAppearanceObserver.OnAppearanceChanged (Xamarin.Forms.ShellAppearance appearance) [0x00011] in :0
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at Xamarin.Forms.Shell.Xamarin.Forms.IShellController.AddAppearanceObserver (Xamarin.Forms.IAppearanceObserver observer, Xamarin.Forms.Element pivot) [0x0001a] in :0
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at Xamarin.Forms.Platform.Android.ShellItemRenderer.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) [0x000bc] in :0
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at Android.Support.V4.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_inflater, System.IntPtr native_container, System.IntPtr native_savedInstanceState) [0x00020] in <12bd1bbeb8ba44d7891a3d564b719f52>:0
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at (wrapper dynamic-method) System.Object.44(intptr,intptr,intptr,intptr,intptr)
08-30 13:22:05.781 25813 25813 E AndroidRuntime: --- End of stack trace from previous location where exception was thrown ---
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in :0
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0005d] in :0
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at Android.App.Activity.OnStart () [0x0000a] in <223593b1d75b41baa6db0d4d38d1d7ee>:0
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.OnStart () [0x00000] in :0
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at Android.App.Activity.n_OnStart (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <223593b1d75b41baa6db0d4d38d1d7ee>:0
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at (wrapper dynamic-method) System.Object.13(intptr,intptr)
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at md51558244f76c53b6aeda52c8a337f2c37.FormsAppCompatActivity.n_onStart(Native Method)
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at md51558244f76c53b6aeda52c8a337f2c37.FormsAppCompatActivity.onStart(FormsAppCompatActivity.java:120)
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1340)
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at android.app.Activity.performStart(Activity.java:7200)
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2918)
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030)
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at android.app.ActivityThread.-wrap11(Unknown Source:0)
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:105)
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164)
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6938)
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
08-30 13:22:05.781 25813 25813 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
08-30 13:22:05.786 3781 3883 W ActivityManager: crash : au.com.sfi.testapp,0
08-30 13:22:05.786 3781 3883 W ActivityManager: Force finishing activity au.com.sfi.testapp/md5997210f592fb55d53312347a33ae5313.MainActivity

From what i can tell, the null exception is because the bottomtab_tabbar resource can't be found via its ID.

This is the YAML of the build:

steps:

  • task: XamarinAndroid@1
    displayName: 'Build Application'
    inputs:
    projectFile: '$(System.DefaultWorkingDirectory)/SourceRepo/$(AndroidProjectName)/$(AndroidProjectName).csproj'
    outputDirectory: '$(System.DefaultWorkingDirectory)/Build'
    configuration: Release
    clean: true

The $(AndroidProjectName) variable is so I could switch between test apps on the one pipeline

Since this crash with the test app, I have added a non-shell page that just has a button that switches to the shell app. The app then works but crashes when you try to navigate to the shell app.

Viewing all 204402 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>