【发布时间】:2019-09-09 15:37:34
【问题描述】:
我(像往常一样)使用 MS App Center 进行发布构建,而我使用 MS App Center 创建的构建 APK 适用于 32 位和 64 位设备。但是在通过应用程序发布(在发布管理中)甚至通过内部应用程序共享(在开发工具中)上传到 Play 商店后,应用程序在启动时崩溃。该应用程序在测试时从 MS App Center 下载后运行。但是当我尝试从 Play 商店安装应用程序时,它崩溃了,甚至没有显示第一个屏幕。
我尝试了什么:
我在我的计算机上测试了该应用程序,当我将它直接部署到设备或模拟器时,它在发布模式下也运行良好。我希望它不起作用,以便我能够诊断出问题所在,但绝对没有抛出异常。
我已经阅读并搜索了很多不同的帖子,但没有一个有效。我尝试过使用 Dex、链接器、收缩器、嵌入原生程序集,甚至使应用程序尽可能大并添加 multidex,但没有任何效果。
事实上,我什至拿了在 play store 上成功发布的旧版本的代码,但这也导致启动时崩溃。我使用多台 Mac 复制此错误,并使用多台 64 位和 32 位设备进行测试。
只是为了测试,我下载了已发布的 Play 商店 APK 并再次将其上传到 Play 商店,但该 APK 工作正常。
Here's 我使用 32 位测试设备的 adb logcat 获得的堆栈跟踪。所有的 logcat 都非常相似。
对于那些无法打开 pastebin 的人,这里有一个总结:
AndroidRuntime: FATAL EXCEPTION: main
Process: com.bgrs.reloaccess, PID: 29347
android.runtime.JavaProxyThrowable: System.FormatException: Input string was not in a correct format.
at System.Number.ThrowOverflowOrFormatException (System.Boolean overflow, System.String overflowResourceKey) [0x0001a] in <915e1956390a4a4c9eeb4e5a86a3b84f>:0
at System.Number.ParseInt32 (System.ReadOnlySpan`1[T] value, System.Globalization.NumberStyles styles, System.Globalization.NumberFormatInfo info) [0x00016] in <915e1956390a4a4c9eeb4e5a86a3b84f>:0
at System.Int32.Parse (System.ReadOnlySpan`1[T] s, System.Globalization.NumberStyles style, System.IFormatProvider provider) [0x0000e] in <915e1956390a4a4c9eeb4e5a86a3b84f>:0
at System.Version.TryParseComponent (System.ReadOnlySpan`1[T] component, System.String componentName, System.Boolean throwOnFailure, System.Int32& parsedComponent) [0x0000b] in <915e1956390a4a4c9eeb4e5a86a3b84f>:0
at System.Version.ParseVersion (System.ReadOnlySpan`1[T] input, System.Boolean throwOnFailure) [0x0011a] in <915e1956390a4a4c9eeb4e5a86a3b84f>:0
at System.Version.Parse (System.String input) [0x00014] in <915e1956390a4a4c9eeb4e5a86a3b84f>:0
at System.Version..ctor (System.String version) [0x00014] in <915e1956390a4a4c9eeb4e5a86a3b84f>:0
at ReloAccess.Droid.LoginActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x000cf] in <34564626c64d48b5bf58d931504c2b9e>:0
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in <8354d046afcb48708fb91f153e8a8cb8>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.12(intptr,intptr,intptr)
at md5eb9edb947e2683f0feaecf2c0d709827.LoginActivity.n_onCreate(Native Method)
at md5eb9edb947e2683f0feaecf2c0d709827.LoginActivity.onCreate(:31)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
ActivityManager: Force finishing activity
Version.Parse 发生在this function。
【问题讨论】:
-
您是否在代码中使用“System.Version.Parse”?
-
是的,我有,但不是我添加的,它是一个较旧的代码库。它说: if (systemStatusResponse.Count > 2 && Version.TryParse(systemStatusResponse[2], out currentVersion)) { systemStatus.CurrentVersion = currentVersion; }
-
@SushiHangover 我已经在我的帖子底部添加了整个功能
标签: c# android xamarin xamarin.android