David Douglas
David Douglas

Reputation: 10503

How to fix missing method exception in Xamarin.Forms PCL Android mobile app

I'm getting a System.MissingMethodException error after updating Xamarin.Forms package for Android Mobile App. In MainActivity.cs line #22:

LoadApplication (new App ());

Application Output:

[] Missing method Android.Runtime.JNIEnv::StartCreateInstance(Type,string,JValue*) in assembly Mono.Android.dll, referenced in assembly /storage/emulated/0/Android/data/XAMLDataBindings_PCL.Droid/files/.__override__/Xamarin.Android.Support.v4.dll

I have tried Clean & Rebuild All as mentioned on the Xamarin forum but still not working. The project works for iOS so not sure why Android project won't run now?

Upvotes: 7

Views: 4689

Answers (4)

Diego Venâncio
Diego Venâncio

Reputation: 6007

In my case was the FloatingActionButton cause the problems!

FAB.Droid.FloatingActionButtonRenderer.InitControl();

Upvotes: 0

Jagger
Jagger

Reputation: 2562

I got this exception just for iOS simulator, cause I use tablet device for Android debugging. Eventually I found it just happened when computer had no Internet access.

So I think the real reason is: there is an exception caused by network, but Xamarin Studio can't give the real detail, and just can give a stupid fake exception like "System.MissingMethodException: Attempted to access a missing method."

Upvotes: 0

Eyal.K
Eyal.K

Reputation: 431

I had the exact same error. Solved it by Upgrading instead of Downgrading which is a bit nicer.

'Xamarin Studio' -> 'Check for Updates'
Answered: "Up to date" enter image description here

But when looking at the Solution tree at the left of the screen under your xxx.Droid project it wrote that the 'Packages' had some updates.
After opening the 'Packages' folder it tells you exactly which package can be updated.
Right click -> Update.
enter image description here

I updated the Xamarin.Android.Support.v4
It worked.
Enjoy.

Upvotes: 1

Dimitris Tavlikos
Dimitris Tavlikos

Reputation: 8170

I also had the same problem today. I removed all Xamarin.* NuGets from the Android project, re-installed Xamarin.Forms and it fetched the previous versions of Xamarin.Android.* NuGets, which is 21.0.3.0. All is working fine now. I am waiting for a fix.

Upvotes: 4

Related Questions