2012-08-15 44 views
3

我有问题,我不能自己解决它。我无法在Release模式下运行我的android api,它在加载System.Web.Service.dll库时停止,然后我得到了MvxException,继续我得到了第二个MvxExcetpion(我想从它的调试模式中猜测它即将关闭应用程序)。MvxException在Android的发布模式

我正在使用MvvmCross - 我的应用程序在WindowsPhone7工作正常,但在Android单声道我遇到问题。

这里是我的输出日志:

- 08-15 17:06:13.242 I/monodroid-gc(1873): environment supports jni NewWeakGlobalRef 
- 08-15 17:06:13.292 W/monodroid-gc(1873): GREF GC Threshold: 1800 
- Loaded assembly: SmartWash.UI.dll 
- Loaded assembly: SmartWash.Core.dll 
- Loaded assembly: Cirrious.MvvmCross.Android.dll 
- Loaded assembly: Newtonsoft.Json.MonoDroid.dll 
- Loaded assembly: Cirrious.MvvmCross.Binding.Android.dll 
- Loaded assembly: Mono.Android.dll [External] 
- Loaded assembly: System.Core.dll [External] 
- Loaded assembly: System.dll [External] 
- Loaded assembly: MonoDroidConstructors [External] 
- Loaded assembly: System.Xml.dll [External] 
- Loaded assembly: System.Web.Services.dll [External] 
- Unhandled Exception: 

- Cirrious.MvvmCross.Exceptions.MvxException: 
- 08-15 17:06:31.972 I/MonoDroid(1873): UNHANDLED EXCEPTION: Cirrious.MvvmCross.Exceptions.MvxException: No Service Factory Constructor included in Assembly! 
- 08-15 17:06:31.972 I/MonoDroid(1873): at Cirrious.MvvmCross.Platform.MvxServiceProviderSetup.Initialize (System.Type,Cirrious.MvvmCross.Interfaces.IoC.IMvxIoCProvider) <IL 0x0002b, 0x001a8> 
- 08-15 17:06:31.972 I/MonoDroid(1873): at Cirrious.MvvmCross.Platform.MvxServiceProviderSetup.Initialize (Cirrious.MvvmCross.Interfaces.IoC.IMvxIoCProvider) <IL 0x00008, 0x0007b> 
- 08-15 17:06:31.972 I/MonoDroid(1873): at Cirrious.MvvmCross.IoC.MvxOpenNetCfServiceProviderSetup.Initialize() <IL 0x00007, 0x0008b> 
- 08-15 17:06:31.972 I/MonoDroid(1873): at Cirrious.MvvmCross.Platform.MvxBaseSetup.InitializeIoC() <IL 0x00000, 0x00043> 
- 08-15 17:06:31.972 I/MonoDroid(1873): at Cirrious.MvvmCross.Platform.MvxBaseSetup.InitializePrimary() <IL 0x00041, 0x001d7> 
- 08-15 17:06:31.972 I/MonoDroid(1873): at Cirrious.MvvmCross.Android.Views.MvxBaseSplashScreenActivity.OnCreate (Android.OS.Bundle) <IL 0x00036, 0x0018b> 
- 08-15 17:06:31.972 I/MonoDroid(1873): at SmartWash.UI.SplashScreenActivity.OnCreate (Android.OS.Bundle) <IL 0x00002, 0x0004f> 
- 08-15 17:06:31.972 I/MonoDroid(1873): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00010] in /Users/builder/data/lanes/monodroid-mac-monodroid-4.2.3-branch/410a5aba/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.App.Activity.cs:1490 
- 08-15 17:06:31.972 I/MonoDroid(1873): at (wrapper dynamic-method) object.891313b6-5c12-4624-844c-14d43e535064 (intptr,intptr,intptr) <IL 0x00012, 0x00033> 
- Unhandled Exception: 

- Cirrious.MvvmCross.Exceptions.MvxException: 

我一直在寻找sollution了几天,现在我太累了,我自己把它。任何建议,非常欢迎!

更新: 在链接“SDK only”中添加LinkerIncludePlease.cs类后,我发现NullReference存在另一个问题,我无法找到它。

这里是我的输出:

- 08-16 10:08:27.922 I/mono (2334): at Cirrious.MvvmCross.Android.ExtensionMethods.MvxAndroidActivityExtensionMethods.OnViewCreate<TViewModel> (Cirrious.MvvmCross.Android.Interfaces.IMvxAndroidView`1<TViewModel>) <IL 0x00043, 0x00243> 
- 08-16 10:08:27.922 I/mono (2334): at Cirrious.MvvmCross.Android.Views.MvxTabActivityView`1.OnCreate (Android.OS.Bundle) <IL 0x00008, 0x00093> 
- 08-16 10:08:27.922 I/mono (2334): at Cirrious.MvvmCross.Binding.Android.Views.MvxBindingTabActivityView`1.OnCreate (Android.OS.Bundle) <IL 0x00008, 0x00077> 
In mgmain JNI_OnLoad 
- 08-16 10:08:27.922 I/mono (2334): at Sm08-16 10:08:27.922 I/mono (2334): at SmartWash.UI.Views.BaseTabbedView`1.OnCreate (Android.OS.Bundle) <IL 0x0000a, 0x00083> 
- 08-16 10:08:27.932 I/mono (2334): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <IL 0x00012, 0x000ef> 
- 08-16 10:08:27.942 I/mono (2334): at (wrapper dynamic-method) object.dc29b95c-fdca-49d9-bdbc-e51d024c54c9 (intptr,intptr,intptr) <IL 0x00012, 0x00033> 
08-16 10:08:27.942 I/mono (2334): at (wrapper native-to-managed) object.dc29b95c-fdca-49d9-bdbc-e51d024c54c9 (intptr,intptr,intptr) <IL 0x0001f, 0xffffffff> 
- Unhandled Exception: 

- System.NullReferenceException: 

- 08-16 10:08:59.102 I/MonoDroid(2334): UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object 
- 08-16 10:08:59.102 I/MonoDroid(2334): at (wrapper delegate-invoke) <Module>.invoke_intptr__this___intptr_intptr_intptr_JValue[] (intptr,intptr,intptr,Android.Runtime.JValue[]) <IL 0x0005d, 0x0011f> 
- 08-16 10:08:59.102 I/MonoDroid(2334): at Android.Runtime.JNIEnv.CallObjectMethod (intptr,intptr,Android.Runtime.JValue[]) <IL 0x00012, 0x000a7> 

回答

3

事实上,这是释放模式而已,再加上事实,这是一个缺失类建议对我来说这可能是一个MonoDroid的连接问题 - MonoDroid的连接被剥出太多班。

解决此问题的最简单方法是将monodroid链接设置更改为“仅限SDK”。

更高级的解决方法是在主项目中包含对反射加载类的引用。一些mvx示例包括这种机制的示例 - 查找名为LinkerPleaseInclude.cs(或类似文件)的文件

+0

我非常感谢您的帮助。那么我已经添加LinkerPleaseInclude.cs类,它的工作原理!但仅限于“仅限SDK”链接。在“SDK和用户大会”我有同样的问题。这些选择之间有很大差异吗? 第二个问题是,在“SDK only”链接中,我有Login Activity,登录后我应该使用Tabs获取MainMenu Activity,但是我得到System.NullReferenceException,并且我不知道在哪里它可能为空。 – lechu 2012-08-16 10:09:58

+0

我的新输出更新 – lechu 2012-08-16 10:18:29

+0

更新:好的,问题与AlertBuilder对话框..我创建它们由服务在类ReportDisplay从代码中的每个地方运行我想要构建它们我需要活动,我得到它来自: var activity = this.GetService ()。Activity; 哪给了我空...任何想法? – lechu 2012-08-16 10:44:48