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

System.MissingMethodException: Method 'Android.App.Notification/Builder.SetChannelId' not found. #155

Open
jelkevdh opened this issue Mar 5, 2018 · 11 comments

Comments

@jelkevdh
Copy link

jelkevdh commented Mar 5, 2018

Version 3.2.1 works fine, but versions 3.3.0 and higher have the following exception:

-		ex	{System.MissingMethodException: Method 'Android.App.Notification/Builder.SetChannelId' not found.
  at Plugin.Toasts.ToastNotification+<>c__DisplayClass5_0.<Notify>b__0 () [0x00054] in D:\Source\Repos\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\ToastNotification.cs:44 
  at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Threading.Tasks.Task.Execute () [0x00010] in <657aa8fea4454dc898a9e5f379c58734>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at Plugin.Toasts.ToastNotification+<Notify>d__5.MoveNext () [0x00031] in D:\Source\Repos\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\ToastNotification.cs:33 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <657aa8fea4454dc898a9e5f379c58734>:0 
  at LoginViewModel+<NavigateToRegisterPageAsync>d__32.MoveNext () [0x00066] in LoginViewModel.cs:187 }	System.MissingMethodException
@adamped
Copy link
Contributor

adamped commented Mar 5, 2018

@jelkevdh - This is not enough information to solve this issue. Please mention which API version you are building and using, and which device this occurs on. Does it occur on all devices/APIs? Please load up the Toasts project source code and try to figure out the error as well. Then you could submit a PR with the actual bug fix. Otherwise this error likely won't be solved, because I can not duplicate it.

@Nico04
Copy link

Nico04 commented Apr 3, 2018

I have the exact same bug, with a (almost) blank project (.NET Standard), with all component up-to-date, using the simple example in readme of this repo.
Works fine with v3.2.1 (after cleaning solution).
Android 7.0.

@mgoodfellow
Copy link

What is interesting is this commit from Jan 2018:

a466278#diff-eb4edc0732b64df8b7078b5537ddb7f5R223

This actually adds a comment about a runtime version of this exception, but now something else has changed and it won't link anymore. I have been using 3.3.0 since December, and suddenly I can't build anymore as the linker isn't happy. I haven't changed any versions of Android support libraries, so it might even be a change to the Xamarin linker which is now stricter in a later patch version of VS.

@mgoodfellow
Copy link

As an aside, I have lifted my minimum supported Android version to 6.0 (API Level 23 - Marshmellow) and it links fine now. I was using Android 5.0 (Level 21) previously.

@tidusjar
Copy link

tidusjar commented Apr 4, 2018

I'm getting the above error and I tried @mgoodfellow suggestion but still no avail on Android.
Using latest nuget package

@mgoodfellow
Copy link

mgoodfellow commented Apr 4, 2018

@tidusjar Some other things I did - I built using Android 8 Oreo SDK, and I also forced the Target Android version to Android 8. I also removed the bin/obj folders by hand rather than cleaning the solution! Also building on latest VS2017 15.6.5 + tools

I'm using Xamarin.Android.Support.v7.AppCompat 25.4.0.2 as well - might have some relevance as that is its dependency?

@PostImpatica
Copy link

I dropped down to 3.2.1

@cassionandi
Copy link

Same error here. Same version of @mgoodfellow, did his suggestion but did not work. Version 3.2.1 also did not work.

@mslavkovski
Copy link

Same error here, are there any solutions?

@PostImpatica
Copy link

@cassionandi I would write a dependency service that creates toasts. This is what I've started doing when I run out of options. I did this recently when I found that the xam.plugins.messaging plugin was forcing my xamarin ios project to want to install .netstandard 1.6 and a bunch of other packages.

HERE is a stack overflow showing you how to create toasts using a dependency service in iOS (look at Alex Chengalan's solution). iOS is always the most difficult for me so that is where I start. If I can find an easy solution for iOS it's normally even easier in Android so then I proceed.

@cassionandi
Copy link

@helzgate I am using this kind of solution for a while. For iOS the Toast.iOS did the Toast-like Android to me without any effort. Recommended.

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

8 participants