Forum Xamarin.Android

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

TinyIOC Release Build Issue

I'm running into a weird issue with TinyIOC when trying to run an release build on my Nexus 4.

Everything works fine in Debug mode, but when I try running the release build I get this Runtime Error:

UNHANDLED EXCEPTION: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: MyDiem.Core.Invokers.ResolveSlideMenuRowTouchedInvoker ---> System.NullReferenceException

Does something change with reflections when in Release build mode?

Posts

  • FZelleFZelle DEMember ✭✭✭

    Yes, the linker might optimize to much.
    Try first without the linker to see if it works then.

    Then check which class is really not there.

  • BenBishopBenBishop USBeta ✭✭
    edited July 2013

    Thanks.

    I changed the project's Link Behavior to "Don't link" and the app runs fine now.

    However, I noticed that it basically tripled the size of the APK (which makes sense.)

    Is there a way for me to better fix this issue so the APK is smaller?

    Maybe specify what assemblies to ignore?

  • ChrisHardyChrisHardy GBForum Administrator, Xamarin Team Xamurai

    Yes, there's a lot of different options you can try to fine tune the linker process - http://docs.xamarin.com/guides/android/advanced_topics/linking

  • FZelleFZelle DEMember ✭✭✭

    I told you to do that just to see if the linker creates the problem.

    Now you have to check which type gets "optimized" and then you can handle that.

    Most of the time this happens because you only use reflection with strings and therefore the linker doesn't know that you need a class.

  • ErlingHagenErlingHagen NOMember

    Sorry to resurrect an old thread, but did you find an answer? I have the exact same problem.

  • BenBishopBenBishop USBeta ✭✭

    I was able to get a build out by setting the project to not link. However, I haven't had a chance yet to try and optimize what gets linked and what doesn't.

  • DennisWeluDennisWelu USUniversity, Developer Group Leader ✭✭

    Related to http://forums.xamarin.com/discussion/8109/tinyioc-xamarin-ios-linker and @bradleyman pointing to http://stackoverflow.com/questions/18901310/tinyioc-xamarin-ios-linker-settings...

    To minimize the lack of linking for Android: in the Options | Android Build | Advanced tab specify "System.Core" in the ignore list. Not ideal but better than no linking at all.

Sign In or Register to comment.