Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The component crashes in MAUI with unsupported platforms #136

Open
erossini opened this issue Jul 5, 2023 · 4 comments
Open

The component crashes in MAUI with unsupported platforms #136

erossini opened this issue Jul 5, 2023 · 4 comments

Comments

@erossini
Copy link

erossini commented Jul 5, 2023

Describe the bug
In my MAUI projects, I have all the platforms (Windows, iOS, Android, MacCatalyst). When I run the application for MacCatalyst, the application crashes. I have to create a different project for it.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NotImplementedException: This functionality is not implemented in the portable version of this assembly.  You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.
  at at Plugin.MauiMTAdmob.CrossMauiMTAdmob.get_Current()
  at MauiAdMob.MainPage..ctor() in /Users/enrico/Projects/MauiAdMob/MauiAdMob/MainPage.xaml.cs:14
  at at System.Reflection.ConstructorInvoker.InterpretedInvoke(Object obj, Span`1 args, BindingFlags invokeAttr)
  --- End of inner exception stack trace ---
  at at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
  at at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
  at at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
  at at System.Activator.CreateInstance(Type type, Boolean nonPublic)
  at at System.Activator.CreateInstance(Type type)
  at at Microsoft.Maui.Controls.ShellContent.<>c__DisplayClass19_0.<Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent>b__0()
  at at Microsoft.Maui.Controls.ElementTemplate.CreateContent()
  at at Microsoft.Maui.Controls.Internals.DataTemplateExtensions.CreateContent(DataTemplate self, Object item, BindableObject container)
  at at Microsoft.Maui.Controls.ShellContent.Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent()
  at at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.LoadRenderers()
  at at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.ViewDidLoad()
  at at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName)
  at at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
  at MauiAdMob.Program.Main(String[] args) in /Users/enrico/Projects/MauiAdMob/MauiAdMob/Platforms/MacCatalyst/Program.cs:13
Screenshot 2023-07-05 at 09 16 51

Should it be possible to fix this issue, so I can have only one project for everything?

Thank you in advance.
Enrico

@marcojak
Copy link
Owner

marcojak commented Jul 5, 2023

Hi Enrico,
MtAdmob is for Xamarin. Are you referring to the plugin for MAUI or this one?
I'll have a look and I'll update it to avoid the crash. I have few projects going on right now but I'll try to fix it asap.

@erossini
Copy link
Author

erossini commented Jul 5, 2023

Thank you for the quick reply.

The one for MAUI. I added Plugin.MauiMTAdmob Is it the correct plugin? I was following your demo code.

Plus, my project uses NET7.

@HardBlock729
Copy link

I was following your demo code.

I used this to get a .Net 8 project going as well. I found my issue was (among a few other smaller things lol) that I was putting the meta-data in the manifest not in the application tag in my AndroidManifest.xml

@marcojak
Copy link
Owner

I'll fix the crash on MacCatalyst in the next version.
Of course there will be no ads (this might change in future) but at least it will not crash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants