Forum Xamarin.Android

Problem with release

utekutek PLMember

Hello,

I've got a problem with building a release version of my app.
When built as Debug (with 'Use shared Mono runtime' checked and Linker behavior: Don't link) it's working on my android device.

But when building a release version. And starting it via "Start without debugging" it's built, deployed but crashes just after it starts.

In App output I've got:

[monodroid-gc] GREF GC Threshold: 46800
[] cant resolve internal call to "System.Runtime.InteropServices.Marshal::ReadIntPtr(intptr,int)" (tested without signature also)
[mono] 
[mono] Your mono runtime and class libraries are out of sync.
[mono] The out of sync library is: mscorlib.dll
[mono] 
[mono] When you update one from svn you need to update, compile and install
[mono] the other too.
[mono] Do not report this as a bug unless you're sure you have updated correctly:
[mono] you probably have a broken mono install.
[mono] If you see other errors or faults after this message they are probably related
[mono] and you need to fix your mono install first.
[] cant resolve internal call to "System.Runtime.InteropServices.Marshal::ReadIntPtr(intptr,int)" (tested without signature also)
[mono] 
[mono] Your mono runtime and class libraries are out of sync.
[mono] The out of sync library is: mscorlib.dll
[mono] 
[mono] When you update one from svn you need to update, compile and install
[mono] the other too.
[mono] Do not report this as a bug unless you're sure you have updated correctly:
[mono] you probably have a broken mono install.
[mono] If you see other errors or faults after this message they are probably related
[mono] and you need to fix your mono install first.
[mono] 
[mono] Unhandled Exception:
[mono] System.MissingMethodException: Cannot find the requested method.
[mono]   at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:ReadIntPtr (intptr,int)
[mono]   at System.Runtime.InteropServices.Marshal.ReadIntPtr (IntPtr ptr) [0x00000] in <filename unknown>:0 
[mono]   at Android.Runtime.JNIEnv.CreateNativeInterface () [0x00000] in <filename unknown>:0 
[mono]   at Android.Runtime.JNIEnv.Initialize (IntPtr envptr, IntPtr grefLoader, IntPtr Loader_loadClass, UInt32 logCategories, IntPtr Class_getName, IntPtr javaVm, Int32 ver, Int32 localRefsAreIndirect, Int32 grefGcThreshold) [0x00000] in <filename unknown>:0 
[mono] [ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Cannot find the requested method.
[mono]   at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:ReadIntPtr (intptr,int)
[mono]   at System.Runtime.InteropServices.Marshal.ReadIntPtr (IntPtr ptr) [0x00000] in <filename unknown>:0 
[mono]   at Android.Runtime.JNIEnv.CreateNativeInterface () [0x00000] in <filename unknown>:0 
[mono]   at Android.Runtime.JNIEnv.Initialize (IntPtr envptr, IntPtr grefLoader, IntPtr Loader_loadClass, UInt32 logCategories, IntPtr Class_getName, IntPtr javaVm, Int32 ver, Int32 localRefsAreIndirect, Int32 grefGcThreshold) [0x00000] in <filename unknown>:0 

I've cleaned all "Mono*" apps from device. Reinstalled Xamarin Studio. But this error is persistent.

Xamarin Studio
Version 4.0.8 (build 2)

Xamarin.Android
Version: 4.6.7 (Business Edition)

Posts

  • FZelleFZelle DEMember ✭✭✭

    Try without linking.
    Seems that the linker sometimes is to keen to optimize.

  • utekutek PLMember

    Nope. Didn't help. Still the same problem.

  • TomOpgenorthTomOpgenorth CAXamarin Team Xamurai
    edited June 2013

    Is there any way you can narrow it down to the method that is missing?

    What API level are you targeting?

    Any chance you can provide a test case that duplicates this issue?

  • StephanReckersStephanReckers USMember
    edited December 2014

    I am also having this issue. Was there any resolution to this?

  • BinZhouBinZhou USMember

    i have this issue when i use xamarin with vs2015,and i cannot build debug apk, years passed ,any help?

  • This fixed it for me following Xamarin Studio updates on OS X - your mileage may vary!
    1. In Xamarin Studio - Clean solution
    2. In emulator - Settings -> Apps -> Uninstall "Mono Shared Runtime", "Xamarin.Android API-* Support", "Xamarin.*.SmokeTests",
    3. Reboot entire machine (old Windows habit following new software install)
    4. Start Xamarin Studio
    5. Start emulator
    6. Rebuild
    7. Debug to emulator

    If I had to guess, it was step 2 that got rid of a prior version of the Mono Shared Runtime and resolved the "Your mono runtime and class libraries are out of sync" error.

  • Thanks @RealPaulSchroeder works like a charm!!

  • sakcinsakcin USMember

    Thanks @RealPaulSchroeder. Great.

  • Thanks! Jun,2017 - I've just updated my phone to Android 7 and my xamarin stopped working. That was the solution.

Sign In or Register to comment.