Skip to content

Default constructor not found for type ViewMarkdown.Forms.Plugin.Droid.WebViewBaseUrl #2

@diescalo

Description

@diescalo

Hello!

I'm trying to use this package in my application, but I get the following error when I try to instantiate a MarkdownView object. I'm using the latest version of the library (1.0.1-beta) in an Android device.

Default constructor not found for type ViewMarkdown.Forms.Plugin.Droid.WebViewBaseUrl

I added the following line in the OnCreate method of the MainActivity.cs Droid project file:

...
global::Xamarin.Forms.Forms.Init(this, bundle);
MarkdownViewRenderer.Init();
...

(I added it because I saw it in the sample project)

And this is how I try to add a MarkdownView element to a page:

var authorsView = new MarkdownView
	{
		Markdown = "# Hello world!\n\nThis is just a test",
		VerticalOptions = LayoutOptions.StartAndExpand,
		HorizontalOptions = LayoutOptions.StartAndExpand,
		BackgroundColor = Color.Transparent
	};

TextsStack.Children.Add(authorsView);

(TextsStack is a StackLayout of the page)

This is the full stack of the error:

10-16 19:06:20.179 I/MonoDroid(19447): UNHANDLED EXCEPTION:
10-16 19:06:20.213 I/MonoDroid(19447): System.MissingMethodException: Default constructor not found for type ViewMarkdown.Forms.Plugin.Droid.WebViewBaseUrl
10-16 19:06:20.213 I/MonoDroid(19447):   at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x0007b] in <0d3e8e8a3e98411ebca0c94b3b240d49>:0 
10-16 19:06:20.213 I/MonoDroid(19447):   at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <0d3e8e8a3e98411ebca0c94b3b240d49>:0 
10-16 19:06:20.213 I/MonoDroid(19447):   at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <0d3e8e8a3e98411ebca0c94b3b240d49>:0 
10-16 19:06:20.213 I/MonoDroid(19447):   at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x0002c] in <0d3e8e8a3e98411ebca0c94b3b240d49>:0 
10-16 19:06:20.213 I/MonoDroid(19447):   at System.Activator.CreateInstance (System.Type type) [0x00000] in <0d3e8e8a3e98411ebca0c94b3b240d49>:0 
10-16 19:06:20.213 I/MonoDroid(19447):   at Xamarin.Forms.DependencyService.Get[T] (Xamarin.Forms.DependencyFetchTarget fetchTarget) [0x0006b] in D:\a\1\s\Xamarin.Forms.Core\DependencyService.cs:43 
10-16 19:06:20.213 I/MonoDroid(19447):   at ViewMarkdown.Forms.Plugin.Abstractions.MarkdownView..ctor (ViewMarkdown.Forms.Plugin.Abstractions.LinkRenderingOption linksOption) [0x00006] in C:\Users\anton\Documents\GitHub\MarkdownView2\MarkdownView.Forms.Plugin.Abstractions\MarkdownView.cs:25 
10-16 19:06:20.213 I/MonoDroid(19447):   at ViewMarkdown.Forms.Plugin.Abstractions.MarkdownView..ctor () [0x00000] in C:\Users\anton\Documents\GitHub\MarkdownView2\MarkdownView.Forms.Plugin.Abstractions\MarkdownView.cs:14 
10-16 19:06:20.213 I/MonoDroid(19447):   at XBeeConfigurator.AboutPage..ctor () [0x0001b] in F:\git_projects\xbee_ble_configuration\XBeeConfigurator\XBeeConfigurator\Pages\AboutPage.xaml.cs:43 
10-16 19:06:20.213 I/MonoDroid(19447):   at XBeeConfigurator.ViewModelBase+<OpenAboutPage>d__24.MoveNext () [0x0000f] in F:\git_projects\xbee_ble_configuration\XBeeConfigurator\XBeeConfigurator\ViewModels\ViewModelBase.cs:112 
10-16 19:06:20.213 I/MonoDroid(19447): --- End of stack trace from previous location where exception was thrown ---
10-16 19:06:20.213 I/MonoDroid(19447):   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in <0d3e8e8a3e98411ebca0c94b3b240d49>:0 
10-16 19:06:20.213 I/MonoDroid(19447):   at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <af582da7fb294035964740921a102296>:0 
10-16 19:06:20.213 I/MonoDroid(19447):   at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <af582da7fb294035964740921a102296>:0 
10-16 19:06:20.214 I/MonoDroid(19447):   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <af582da7fb294035964740921a102296>:0 
10-16 19:06:20.214 I/MonoDroid(19447):   at (wrapper dynamic-method) System.Object.40(intptr,intptr)

Do you know what could be the issue?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions