首页 > 解决方案 > Android 应用程序从 google play store 下载后立即崩溃

问题描述

我创建了一个 Android 应用程序,当我在我的 Android 手机上的 Visual Studio 2019 中调试它时,它运行得非常好。但是当我将它发布到谷歌商店并下载它并在同一部手机上运行它时,它会立即崩溃。

堆栈跟踪是:

android.runtime.JavaProxyThrowable: at FreshTinyIoC.FreshTinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, System.Reflection.ConstructorInfo constructor, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) <0x7e57beb580 + 0x006f0> in <035575fde1c44c4eaa00de78a4f3093f>:0
at FreshTinyIoC.FreshTinyIoCContainer.ConstructType (System.Type requestedType, System.Type implementationType, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) <0x7e57be9354 + 0x00053> in <035575fde1c44c4eaa00de78a4f3093f>:0
at FreshTinyIoC.FreshTinyIoCContainer.ResolveInternal (FreshTinyIoC.FreshTinyIoCContainer+TypeRegistration registration, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) <0x7e57beade0 + 0x006ff> in <035575fde1c44c4eaa00de78a4f3093f>:0
at FreshTinyIoC.FreshTinyIoCContainer.Resolve (System.Type resolveType) <0x7e57be85d4 + 0x00083> in <035575fde1c44c4eaa00de78a4f3093f>:0
at FreshTinyIoC.FreshTinyIoCContainer.Resolve[ResolveType] () <0x7e57be8668 + 0x0003b> in <035575fde1c44c4eaa00de78a4f3093f>:0
at FreshMvvm.FreshTinyIOCBuiltIn.Resolve[ResolveType] () <0x7e57b810c0 + 0x00047> in <d2b205c381d14059b4260d7482e68c02>:0
at FreshMvvm.FreshPageModelResolver.ResolvePageModel[T] (System.Object initData) <0x7e57b80c90 + 0x00057> in <d2b205c381d14059b4260d7482e68c02>:0
at FreshMvvm.FreshPageModelResolver.ResolvePageModel[T] () <0x7e57b80c54 + 0x00033> in <d2b205c381d14059b4260d7482e68c02>:0
at GoTexas.App.InitNavigation () <0x7e57b426f4 + 0x00037> in <dd7679dd949e46e680e37995753481d2>:0
at GoTexas.App..ctor () <0x7e57b42600 + 0x0009f> in <dd7679dd949e46e680e37995753481d2>:0
at GoTexas.Droid.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) <0x7e54f0b75c + 0x0010f> in <a02812a7c00f4c1c87e549cce19fa824>:0
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) <0x7e598ad064 + 0x0007b> in <899f47c5cea3409e92f041348b58600b>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.7(intptr,intptr,intptr)
  at md5b9bd3a38d4378f5ce9f0aa132dfd154f.MainActivity.n_onCreate (Native Method)
  at md5b9bd3a38d4378f5ce9f0aa132dfd154f.MainActivity.onCreate (30)
  at android.app.Activity.performCreate (Activity.java:7327)
  at android.app.Activity.performCreate (Activity.java:7318)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1271)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3094)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3257)
  at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:78)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1948)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:214)
  at android.app.ActivityThread.main (ActivityThread.java:7050)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:964)

所以它与 FreshTinyIoC 有关。我只是不明白为什么在我的手机上以调试模式运行 VS 2019 时这会起作用。

任何想法将不胜感激。

标签: visual-studioxamarinxamarin.androidfreshmvvm

解决方案


这个问题很简单,实际上你已经设置了到 SDK 和用户程序集的链接,这意味着它正在链接所有东西、你的模型和所有其他类,任何没有参考的东西都将被收集和删除以便更好地理解你可以查看我的博客有一整节关于如何使用链接:

https://heartbeat.fritz.ai/reducing-the-app-size-in-xamarin-deep-dive-7ddc9cb12688

截至目前,我建议您Link SDK Assemblies现在可以检查,然后您可以链接所有内容,因为这需要一点时间

祝你好运,如有疑问请随时回复


推荐阅读