简体   繁体   English

MvvmCross Xamarin Android通过链接挂在初始屏幕上

[英]MvvmCross Xamarin Android Hangs on Splash Screen with linking

I am using MvvmCross 6.1.2 with Xamarin Android. 我在Xamarin Android上使用MvvmCross 6.1.2。 With linking “sdk and user assemblies”, my apps hangs in the splash screen. 通过链接“ sdk和用户程序集”,我的应用程序挂在初始屏幕中。 Unlike other linking issues, there is no error in the log. 与其他链接问题不同,日志中没有错误。 No clue how to fix it. 不知道如何解决它。

The normal flow of the init process: Setup.InitializeFirstChance -> App.Initialize -> Setup.InitializeLastChance 初始化过程的正常流程是:Setup.InitializeFirstChance-> App.Initialize-> Setup.InitializeLastChance

What I can identify so far is something get wrong in between App.Initialize and Setup.InitializeLastChance. 到目前为止,我所能确定的是App.Initialize和Setup.InitializeLastChance之间出现错误。 With linking, app can run up to end of App.Initialize but never reach Setup.InitializeLastChance. 通过链接,应用程序可以运行到App.Initialize的末尾,但永远不会到达Setup.InitializeLastChance。

I have attached 2 logs below. 我在下面附加了2条日志。 Both logs recorded from the end of App.Initialize. 这两个日志均从App.Initialize末尾记录。 The first one is with linking till app hang. 第一个是链接直到应用程序挂起。 The second one is no linking till beginning of Setup.InitializeLastChange. 第二个是直到Setup.InitializeLastChange开始才链接。

Log with linking 链接登录

09-12 15:23:40.260 V/MvvmCross.Core.MvxSetup( 7685): [Verbose] Setup: ViewModelTypeFinder start
Thread started: <Thread Pool> #12
09-12 15:23:40.292 D/Mono( 7685) : Assembly Ref addref a.Core[0xd727b560] -> Acr.UserDialogs[0xd727a9c0]: 3
09-12 15:23:40.294 D/Mono    ( 7685): Assembly Ref addref Acr.UserDialogs[0xd727a9c0] -> mscorlib[0xd727a180]: 73
09-12 15:23:40.295 D/Mono    ( 7685): Assembly Ref addref a.Core[0xd727b560] -> System.Core[0xc61b91e0]: 8
09-12 15:23:40.295 D/Mono    ( 7685): Assembly Ref addref a.Core[0xd727b560] -> Splat[0xd727bd40]: 2
09-12 15:23:40.295 D/Mono    ( 7685): Assembly Ref addref Splat[0xd727bd40] -> mscorlib[0xd727a180]: 74
09-12 15:23:40.298 D/Mono( 7685) : Image addref System.Xml[0xddd06500] -> System.Xml.dll[0xc1166000]: 2
09-12 15:23:40.299 D/Mono( 7685) : Prepared to set up assembly 'System.Xml' (System.Xml.dll)
09-12 15:23:40.299 D/Mono( 7685) : Assembly System.Xml[0xddd06500] added to domain RootDomain, ref_count= 1
09-12 15:23:40.300 D/Mono    ( 7685): AOT: image 'System.Xml.dll.so' not found: dlopen failed: library "/data/app/a.Droid-1/lib/x86/libaot-System.Xml.dll.so" not found
09-12 15:23:40.300 D/Mono( 7685) : AOT: image '/usr/local/lib/mono/aot-cache/x86/System.Xml.dll.so' not found: dlopen failed: library "/data/app/a.Droid-1/lib/x86/libaot-System.Xml.dll.so" not found
09-12 15:23:40.301 D/Mono( 7685) : Config attempting to parse: 'System.Xml.dll.config'.
09-12 15:23:40.301 D/Mono( 7685) : Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Xml/System.Xml.config'.
09-12 15:23:40.301 D/Mono( 7685) : Assembly Ref addref a.Core[0xd727b560] -> System.Xml[0xddd06500]: 2Loaded assembly: System.Xml.dll[External]

09-12 15:23:40.301 D/Mono    ( 7685): Assembly Ref addref System.Xml[0xddd06500] -> mscorlib[0xd727a180]: 75
09-12 15:23:40.302 D/Mono    ( 7685): Assembly Ref addref a.Core[0xd727b560] -> Plugin.Permissions[0xd727b980]: 2
09-12 15:23:40.302 D/Mono    ( 7685): Assembly Ref addref Plugin.Permissions[0xd727b980] -> mscorlib[0xd727a180]: 76
09-12 15:23:40.302 D/Mono    ( 7685): Assembly Ref addref a.Core[0xd727b560] -> Plugin.InAppBilling.Abstractions[0xd727b620]: 3
09-12 15:23:40.302 D/Mono    ( 7685): Assembly Ref addref Plugin.InAppBilling.Abstractions[0xd727b620] -> mscorlib[0xd727a180]: 77
09-12 15:23:40.304 D/Mono    ( 7685): Assembly Ref addref a.Core[0xd727b560] -> MvvmCross.Plugin.Network[0xd727b440]: 2Loaded assembly: System.Net.Http.dll[External]
09-12 15:23:40.308 D/Mono    ( 7685): Image addref System.Net.Http[0xddd06680] -> System.Net.Http.dll[0xc1168300]: 2

09-12 15:23:40.308 D/Mono( 7685) : Prepared to set up assembly 'System.Net.Http' (System.Net.Http.dll)
09-12 15:23:40.308 D/Mono( 7685) : Assembly System.Net.Http[0xddd06680] added to domain RootDomain, ref_count= 1
09-12 15:23:40.310 D/Mono    ( 7685): AOT: image 'System.Net.Http.dll.so' not found: dlopen failed: library "/data/app/a.Droid-1/lib/x86/libaot-System.Net.Http.dll.so" not found
09-12 15:23:40.310 D/Mono( 7685) : AOT: image '/usr/local/lib/mono/aot-cache/x86/System.Net.Http.dll.so' not found: dlopen failed: library "/data/app/a.Droid-1/lib/x86/libaot-System.Net.Http.dll.so" not found
09-12 15:23:40.310 D/Mono( 7685) : Config attempting to parse: 'System.Net.Http.dll.config'.
09-12 15:23:40.310 D/Mono( 7685) : Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Net.Http/System.Net.Http.config'.
09-12 15:23:40.310 D/Mono( 7685) : Assembly Ref addref a.Core[0xd727b560] -> System.Net.Http[0xddd06680]: 2
09-12 15:23:40.310 D/Mono    ( 7685): Assembly Ref addref System.Net.Http[0xddd06680] -> mscorlib[0xd727a180]: 78
09-12 15:23:40.310 D/Mono    ( 7685): Assembly Ref addref a.Core[0xd727b560] -> Newtonsoft.Json[0xd727b740]: 3
09-12 15:23:40.310 D/Mono    ( 7685): Assembly Ref addref Newtonsoft.Json[0xd727b740] -> System.Core[0xc61b91e0]: 9
09-12 15:23:40.310 D/Mono    ( 7685): Assembly Ref addref Newtonsoft.Json[0xd727b740] -> System[0xc61bbd00]: 12
09-12 15:23:40.345 V/MvvmCross.Core.MvxSetup( 7685): [Verbose] Setup: ViewsContainer start
09-12 15:23:40.348 V/MvvmCross.Core.MvxSetup( 7685): [Verbose] Setup: Views start

Log without linking 无需链接即可登录

09-12 15:33:28.200 V/MvvmCross.Core.MvxSetup( 8211): [Verbose] Setup: ViewModelTypeFinder start
09-12 15:33:28.210 D/Mono( 8211) : Assembly Ref addref a.Core[0xe8a8d920] -> Acr.UserDialogs[0xe8a8cd20]: 3
09-12 15:33:28.214 D/Mono    ( 8211): Assembly Ref addref Acr.UserDialogs[0xe8a8cd20] -> mscorlib[0xe8a8c480]: 70
09-12 15:33:28.215 D/Mono    ( 8211): Assembly Ref addref netstandard[0xddd05840] -> System.Core[0xc60af900]: 8
09-12 15:33:28.216 D/Mono( 8211) : Assembly Ref addref a.Core[0xe8a8d920] -> Splat[0xe8a8e280]: 2
09-12 15:33:28.216 D/Mono    ( 8211): Assembly Ref addref Splat[0xe8a8e280] -> mscorlib[0xe8a8c480]: 71
09-12 15:33:28.220 D/Mono( 8211) : Image addref System.Xml[0xddd065c0] -> System.Xml.dll[0xc1c03f00]: 2
09-12 15:33:28.220 D/Mono( 8211) : Prepared to set up assembly 'System.Xml' (System.Xml.dll)
09-12 15:33:28.220 D/Mono( 8211) : Assembly System.Xml[0xddd065c0] added to domain RootDomain, ref_count= 1
09-12 15:33:28.222 D/Mono    ( 8211): AOT: image 'System.Xml.dll.so' not found: dlopen failed: library "/data/app/a.Droid-1/lib/x86/libaot-System.Xml.dll.so" not found
09-12 15:33:28.222 D/Mono( 8211) : AOT: image '/usr/local/lib/mono/aot-cache/x86/System.Xml.dll.so' not found: dlopen failed: library "/data/app/a.Droid-1/lib/x86/libaot-System.Xml.dll.so" not found
09-12 15:33:28.223 D/Mono( 8211) : Config attempting to parse: 'System.Xml.dll.config'.Loaded assembly: System.Xml.dll[External]

09-12 15:33:28.223 D/Mono( 8211) : Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Xml/System.Xml.config'.
09-12 15:33:28.223 D/Mono( 8211) : Assembly Ref addref netstandard[0xddd05840] -> System.Xml[0xddd065c0]: 2
09-12 15:33:28.223 D/Mono( 8211) : Assembly Ref addref System.Xml[0xddd065c0] -> mscorlib[0xe8a8c480]: 72
09-12 15:33:28.224 D/Mono    ( 8211): Assembly Ref addref a.Core[0xe8a8d920] -> Plugin.Permissions[0xe8a8dd40]: 2
09-12 15:33:28.224 D/Mono    ( 8211): Assembly Ref addref Plugin.Permissions[0xe8a8dd40] -> mscorlib[0xe8a8c480]: 73
09-12 15:33:28.224 D/Mono    ( 8211): Assembly Ref addref a.Core[0xe8a8d920] -> Plugin.InAppBilling.Abstractions[0xe8a8d9e0]: 3
09-12 15:33:28.227 D/Mono    ( 8211): Unloading image System.Runtime.dll[0xc1c04400].Loaded assembly: System.Net.Http.dll[External]

09-12 15:33:28.228 D/Mono( 8211) : Image addref System.Runtime[0xddd05a20] -> System.Runtime.dll[0xc60ec000]: 11
09-12 15:33:28.228 D/Mono( 8211) : Config attempting to parse: 'System.Runtime.dll.config'.
09-12 15:33:28.228 D/Mono( 8211) : Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Runtime/System.Runtime.config'.
09-12 15:33:28.228 D/Mono( 8211) : Assembly Ref addref Plugin.InAppBilling.Abstractions[0xe8a8d9e0] -> System.Runtime[0xc60af660]: 9
09-12 15:33:28.229 D/Mono    ( 8211): Assembly Ref addref a.Core[0xe8a8d920] -> MvvmCross.Plugin.Network[0xe8a8d800]: 2
09-12 15:33:28.232 D/Mono    ( 8211): Image addref System.Net.Http[0xddd05a20] -> System.Net.Http.dll[0xc1c05d00]: 2
09-12 15:33:28.232 D/Mono( 8211) : Prepared to set up assembly 'System.Net.Http' (System.Net.Http.dll)
09-12 15:33:28.232 D/Mono( 8211) : Assembly System.Net.Http[0xddd05a20] added to domain RootDomain, ref_count= 1
09-12 15:33:28.233 D/Mono    ( 8211): AOT: image 'System.Net.Http.dll.so' not found: dlopen failed: library "/data/app/a.Droid-1/lib/x86/libaot-System.Net.Http.dll.so" not found
09-12 15:33:28.234 D/Mono( 8211) : AOT: image '/usr/local/lib/mono/aot-cache/x86/System.Net.Http.dll.so' not found: dlopen failed: library "/data/app/a.Droid-1/lib/x86/libaot-System.Net.Http.dll.so" not found
09-12 15:33:28.234 D/Mono( 8211) : Config attempting to parse: 'System.Net.Http.dll.config'.
09-12 15:33:28.234 D/Mono( 8211) : Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Net.Http/System.Net.Http.config'.
09-12 15:33:28.234 D/Mono( 8211) : Assembly Ref addref netstandard[0xddd05840] -> System.Net.Http[0xddd05a20]: 2
09-12 15:33:28.234 D/Mono( 8211) : Assembly Ref addref System.Net.Http[0xddd05a20] -> mscorlib[0xe8a8c480]: 74
09-12 15:33:28.234 D/Mono    ( 8211): Assembly Ref addref a.Core[0xe8a8d920] -> Newtonsoft.Json[0xe8a8db00]: 3
09-12 15:33:28.256 V/MvvmCross.Core.MvxSetup( 8211): [Verbose] Setup: ViewsContainer start
09-12 15:33:28.259 V/MvvmCross.Core.MvxSetup( 8211): [Verbose] Setup: Views start
09-12 15:33:28.289 D/Mono( 8211) : Image addref System.Runtime.Serialization[0xddd05cc0] -> System.Runtime.Serialization.dll[0xc1c06700]: 2
Loaded assembly: System.Runtime.Serialization.dll[External]09-12 15:33:28.289 D/Mono( 8211) : Prepared to set up assembly 'System.Runtime.Serialization' (System.Runtime.Serialization.dll)

09-12 15:33:28.289 D/Mono( 8211) : Assembly System.Runtime.Serialization[0xddd05cc0] added to domain RootDomain, ref_count= 1
09-12 15:33:28.290 D/Mono    ( 8211): AOT: image 'System.Runtime.Serialization.dll.so' not found: dlopen failed: library "/data/app/a.Droid-1/lib/x86/libaot-System.Runtime.Serialization.dll.so" not found
09-12 15:33:28.291 D/Mono( 8211) : AOT: image '/usr/local/lib/mono/aot-cache/x86/System.Runtime.Serialization.dll.so' not found: dlopen failed: library "/data/app/a.Droid-1/lib/x86/libaot-System.Runtime.Serialization.dll.so" not found
09-12 15:33:28.291 D/Mono( 8211) : Config attempting to parse: 'System.Runtime.Serialization.dll.config'.
09-12 15:33:28.291 D/Mono( 8211) : Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Runtime.Serialization/System.Runtime.Serialization.config'.
09-12 15:33:28.291 D/Mono( 8211) : Assembly Ref addref Mono.Android[0xc60af600] -> System.Runtime.Serialization[0xddd05cc0]: 2
09-12 15:33:28.291 D/Mono    ( 8211): Assembly Ref addref System.Runtime.Serialization[0xddd05cc0] -> mscorlib[0xe8a8c480]: 75
09-12 15:33:28.395 V/MvvmCross.Core.MvxSetup( 8211): [Verbose] Setup: CommandCollectionBuilder start
09-12 15:33:28.396 V/MvvmCross.Core.MvxSetup( 8211): [Verbose] Setup: NavigationSerializer start
09-12 15:33:28.398 V/MvvmCross.Core.MvxSetup( 8211): [Verbose] Setup: InpcInterception start
09-12 15:33:28.399 V/MvvmCross.Core.MvxSetup( 8211): [Verbose] Setup: InpcInterception start
09-12 15:33:28.402 V/MvvmCross.Core.MvxSetup( 8211): [Verbose] Setup: LastChance start
09-12 15:33:28.433 D/Mono( 8211) : Assembly Ref addref a.Droid[0xe8a8c600] -> Plugin.LocalNotifications[0xe8a8dce0]: 2
09-12 15:33:28.433 D/Mono    ( 8211): Assembly Ref addref Plugin.LocalNotifications[0xe8a8dce0] -> mscorlib[0xe8a8c480]: 76
09-12 15:33:28.433 D/Mono    ( 8211): Assembly Ref addref Plugin.LocalNotifications[0xe8a8dce0] -> Plugin.LocalNotifications.Abstractions[0xe8a8dc80]: 2

Any help is highly appreciated. 非常感谢您的帮助。

Thanks, 谢谢,

Nick 缺口

This kind of situations are very annoying and very hard to diagnose... 这种情况很烦人,很难诊断...

First off, I would suggest using linker.config . 首先,我建议使用linker.config You will get much more control over what shouldn't be linked away with it - it's very easy to set up as well. 您将对不应该与其链接的内容有更多的控制-设置起来也很容易。

Once you have the linker.config file in place, I would suggest trying the setup that I use for one of my apps: 放置好linker.config文件后,建议您尝试使用其中一个应用程序进行安装:

<?xml version="1.0" encoding="utf-8"?>
<linker>   
    <assembly fullname="MvvmCross">
        <type fullname="MvvmCross.IoC.MvxPropertyInjector"/>
        <namespace fullname="MvvmCross.ViewModels" />
    </assembly>
    <assembly fullname="MvvmCross.Forms">
        <type fullname="MvvmCross.Forms.Platforms.Android.Views.MvxFormsAppCompatActivity"/>
    </assembly>
    <assembly fullname="MvvmCross.Droid.Support.V7.AppCompat">
        <type fullname="MvxAppCompatActivity"/>
    </assembly>
</linker>

I've got more assemblies listed in my linker.config file, but I'm not sure how relevant these would be in your case. 我的linker.config文件中列出了更多程序集,但是我不确定这些情况与您的情况有多相关。 Please try adding the above to your linker.config file and check if you're still experiencing issues. 请尝试将以上内容添加到linker.config文件中,然后检查您是否仍然遇到问题。

If your app still keeps on dying, then what I tend to do is, to literally list all of your assemblies (project references) in the linker file, like so: 如果您的应用仍然不停运转,那么我倾向于做的是在链接器文件中逐字列出所有程序集(项目引用),如下所示:

<assembly fullname="<Assembly_Name>">
    <type fullname="*"/>
</assembly>
<assembly fullname="<Assembly_2_Name>">
    <type fullname="*"/>
</assembly>

I do this, because even though you might think that it's MvvmCross stuff that's causing problems, chances are that it can be completely different library/assembly. 我这样做是因为,即使您可能认为是MvvmCross东西引起了问题,但很有可能它可能是完全不同的库/程序集。 This list, of all of the assemblies, will basically instruct the linker to keep every Type in these assemblies (won't strip a thing!). 所有程序集中的此列表将基本上指示链接程序将每个Type保留在这些程序集中(不会剥离任何内容!)。 The app should run just fine with these. 这些应用程序应该可以正常运行。 Once it does, you start removing assemblies from the list. 完成后,您便开始从列表中删除程序集。 You can do it one by one or split it in half and remove first or second half - basically start eliminating assemblies. 您可以一个接一个地完成它,也可以将它分成两半,然后删除前半部分或后半部分-基本上是开始消除装配。 When you do that, you might want to delete bin and obj , with each and every assembly elimination - just to be extra sure that dll's are being re-generated. 这样做时,您可能希望删除binobj ,并消除每个程序集-只是要确保确保重新生成了dll。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM