2

在从 Android 4.4 – KitKat(API 级别 19)到 Android 10 – Q(API 级别 29)的各种不同设备和 Android 版本上测试我们的应用程序。该应用程序应至少支持 4.4,但 appcenter 测试显示它至少在 Android 6.0 - Marshmallow(API 级别 23)下运行。API 级别 19-22(甚至某些其他设备)上的测试失败并导致 POST 失败异常。

错误日志“测试失败”和“设备日志”并没有太大帮助,因为它们都没有详细说明产生的两个错误的来源。

SetUp : System.Net.WebException : POST Failed

Java.Lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.util.Locale.getLanguage()' on a null object reference

第一个出现在“测试失败”中,后者出现在“设备日志”中多次,但两者都没有。不确定这两者如何相关,因为它们看起来不相关。

尝试通过解决方案处理 post failed 异常。它表明错误是由于给定设备无法信任自签名证书造成的。但是,实施该解决方案并不能减轻异常。

通过控制台输出验证 VS 应用中心设备本身具有互联网并且它报告了可访问的 WiFi 连接

I/mono-stdout(26664): *** ENTER ReachabilityCheck ***
I/mono-stdout(26664): ConnectionState?: WiFi
I/mono-stdout(26664): Reachable?: True
I/mono-stdout(26664): *** exit ReachabilityCheck ***

日志如下。没有真正清楚是什么导致了错误。使用打印输出检查应用程序启动时的每个类实例化和方法调用,并且所有进入和退出都没有错误。

如何最好地解决这些异常并确定它们的来源?这个过程中最困难的部分是该应用程序在我们的测试设备 Galaxy S9+ 上运行良好,但是当我们无法重现时,我们不知道如何在本地进行调试。

测试失败日志

SetUp : System.Net.WebException : POST Failed  
    at Xamarin.UITest.Shared.Http.HttpClient.HandleHttpError(System.String method, System.Net.Http.HttpResponseMessage response, Xamarin.UITest.Shared.Http.ExceptionPolicy exceptionPolicy) [0x00052] in <2a16c16730a54859bda72c6bc1c728f7>:0   
    at Xamarin.UITest.Shared.Http.HttpClient.SendData(System.String endpoint, System.String method, System.Net.Http.HttpContent content, Xamarin.UITest.Shared.Http.ExceptionPolicy exceptionPolicy, System.Nullable`1[T] timeOut) [0x00123] in <2a16c16730a54859bda72c6bc1c728f7>:0   
    at Xamarin.UITest.Shared.Http.HttpClient.Post(System.String endpoint, System.String arguments, Xamarin.UITest.Shared.Http.ExceptionPolicy exceptionPolicy, System.Nullable`1[T] timeOut) [0x00014] in <2a16c16730a54859bda72c6bc1c728f7>:0   
    at Xamarin.UITest.Shared.Android.HttpApplicationStarter.Execute(System.String intentJson) [0x00035] in <2a16c16730a54859bda72c6bc1c728f7>:0   
    at Xamarin.UITest.Shared.Android.TestCloudAndroidAppLifeCycle.LaunchApp(Xamarin.UITest.Shared.Android.ApkFile appApkFile, Xamarin.UITest.Shared.Android.ApkFile testServerApkFile, System.Int32 testServerPort) [0x0007d] in <2a16c16730a54859bda72c6bc1c728f7>:0   
    at Xamarin.UITest.Android.AndroidApp..ctor(Xamarin.UITest.Configuration.IAndroidAppConfiguration appConfiguration, Xamarin.UITest.Shared.Execution.IExecutor executor) [0x00198] in <2a16c16730a54859bda72c6bc1c728f7>:0   
    at Xamarin.UITest.Android.AndroidApp..ctor(Xamarin.UITest.Configuration.IAndroidAppConfiguration appConfiguration) [0x00000] in <2a16c16730a54859bda72c6bc1c728f7>:0   
    at Xamarin.UITest.Configuration.AndroidAppConfigurator.StartApp(Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00017] in <2a16c16730a54859bda72c6bc1c728f7>:0   
    at MyXamarinApp.UITests.AppInitializer.StartApp(Xamarin.UITest.Platform platform) [0x0001c] in <dde3e94fab0f4c759900a21505cc71ba>:0   
    at MyXamarinApp.UITests.Tests.BeforeEachTest() [0x00000] in <dde3e94fab0f4c759900a21505cc71ba>:0   
    at(wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke(System.Reflection.MonoMethod, object, object[], System.Exception&)  
    at System.Reflection.MonoMethod.Invoke(System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <48b95f3df5804531818f80e28ec60191>:0

设备日志

I/MonoDroid(18204): UNHANDLED EXCEPTION:
I/MonoDroid(18204): Java.Lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.util.Locale.getLanguage()' on a null object reference
I/MonoDroid(18204):   at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in <5bb7aef66ad04ab6a7aebddf719db2c9>:0 
I/MonoDroid(18204):   at Java.Interop.JniPeerMembers+JniInstanceMethods.FinishCreateInstance (System.String constructorSignature, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0004f] in <5bb7aef66ad04ab6a7aebddf719db2c9>:0 
I/MonoDroid(18204):   at Android.Support.V7.Widget.AppCompatButton..ctor (Android.Content.Context context) [0x0007a] in <f36899d7138d4405bc94ab104323224d>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.AppCompat.ButtonRenderer.CreateNativeControl () [0x00006] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.AppCompat.ButtonRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1[TElement] e) [0x00017] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000cb] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0001f] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x000c0] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00142] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000e8] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0001f] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x000c0] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00142] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000e8] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Content.Context context) [0x0001f] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x000c0] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00142] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000e8] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Support.V4.App.FragmentManager fragmentManager, Android.Content.Context context) [0x00031] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) [0x0001b] in <417fcf321d224e098a7d0491301d2236>:0 
I/MonoDroid(18204):   at Android.Support.V4.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_inflater, System.IntPtr native_container, System.IntPtr native_savedInstanceState) [0x00020] in <1cf8aa575c3e489899028adaf44662eb>:0 
I/MonoDroid(18204):   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.88(intptr,intptr,intptr,intptr,intptr)
I/MonoDroid(18204):   --- End of managed Java.Lang.NullPointerException stack trace ---
I/MonoDroid(18204): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.util.Locale.getLanguage()' on a null object reference
I/MonoDroid(18204):     at java.lang.CaseMapper.toUpperCase(CaseMapper.java:151)
I/MonoDroid(18204):     at java.lang.String.toUpperCase(String.java:1406)
I/MonoDroid(18204):     at android.text.method.AllCapsTransformationMethod.getTransformation(AllCapsTransformationMethod.java:43)
I/MonoDroid(18204):     at android.widget.TextView.setText(TextView.java:4790)
I/MonoDroid(18204):     at android.widget.TextView.setText(TextView.java:4678)
I/MonoDroid(18204):     at android.widget.TextView.setText(TextView.java:4653)
I/MonoDroid(18204):     at android.widget.TextView.setTransformationMethod(TextView.java:2288)
I/MonoDroid(18204):     at android.widget.TextView.<init>(TextView.java:1763)
I/MonoDroid(18204):     at android.widget.Button.<init>(Button.java:115)
I/MonoDroid(18204):     at android.widget.Button.<init>(Button.java:108)
I/MonoDroid(18204):     at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:71)
I/MonoDroid(18204):     at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:67)
I/MonoDroid(18204):     at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:63)
I/MonoDroid(18204):     at md58432a647068b097f9637064b8985a5e0.FragmentContainer.n_onCreateView(Native Method)
I/MonoDroid(18204):     at md58432a647068b097f9637064b8985a5e0.FragmentContainer.onCreateView(FragmentContainer.java:33)
I/MonoDroid(18204):     at android.support.v4.app.Fragment.performCreateView(Fragment.java:2439)
I/MonoDroid(18204):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
I/MonoDroid(18204):     at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
I/MonoDroid(18204):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
I/MonoDroid(18204):     at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:802)
I/MonoDroid(18204):     at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
I/MonoDroid(18204):     at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
I/MonoDroid(18204):     at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
I/MonoDroid(18204):     at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2243)
I/MonoDroid(18204):     at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:654)
I/MonoDroid(18204):     at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:146)
I/MonoDroid(18204):     at android.support.v4.view.ViewPager.populate(ViewPager.java:1244)
I/MonoDroid(18204):     at android.support.v4.view.ViewPager.populate(ViewPager.java:1092)
I/MonoDroid(18204):     at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1622)
I/MonoDroid(18204):     at android.view.View.measure(View.java:18843)
I/MonoDroid(18204):     at md58432a647068b097f9637064b8985a5e0.CarouselPageRenderer.n_onLayout(Native Method)
I/MonoDroid(18204):     at md58432a647068b097f9637064b8985a5e0.CarouselPageRenderer.onLayout(CarouselPageRenderer.java:67)
I/MonoDroid(18204):     at android.view.View.layout(View.java:16916)
I/MonoDroid(18204):     at android.view.ViewGroup.layout(ViewGroup.java:5405)
I/MonoDroid(18204):     at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:37)
I/MonoDroid(18204):     at md51558244f76c53b6aeda52c8a337f2c37.PlatformRenderer.n_onLayout(Native Method)
I/MonoDroid(18204):     at md51558244f76c53b6aeda52c8a337f2c37.PlatformRenderer.onLayout(PlatformRenderer.java:55)
I/MonoDroid(18204):     at android.view.View.layout(View.java:16916)
I/MonoDroid(18204):     at android.view.ViewGroup.layout(ViewGroup.java:5405)
I/MonoDroid(18204):     at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1077)
I/MonoDroid(18204):     at android.view.View.layout(View.java:16916)
I/MonoDroid(18204):     at android.view.ViewGroup.layout(ViewGroup.java:5405)
I/MonoDroid(18204):     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
I/MonoDroid(18204):     at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
I/MonoDroid(18204):     at android.view.View.layout(View.java:16916)
I/MonoDroid(18204):     at android.view.ViewGroup.layout(ViewGroup.java:5405)
I/MonoDroid(18204):     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
I/MonoDroid(18204):     at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
I/MonoDroid(18204):     at android.view.View.layout(View.java:16916)
I/MonoDroid(18204):     at android.view.ViewGroup.layout(ViewGroup.java:5405)
I/MonoDroid(18204):     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
I/MonoDroid(18204):     at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
I/MonoDroid(18204):     at android.view.View.layout(View.java:16916)
I/MonoDroid(18204):     at android.view.ViewGroup.layout(ViewGroup.java:5405)
I/MonoDroid(18204):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1702)
I/MonoDroid(18204):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1556)
I/MonoDroid(18204):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1465)
I/MonoDroid(18204):     at android.view.View.layout(View.java:16916)
I/MonoDroid(18204):     at android.view.ViewGroup.layout(ViewGroup.java:5405)
I/MonoDroid(18204):     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
I/MonoDroid(18204):     at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
I/MonoDroid(18204):     at android.view.View.layout(View.java:16916)
I/MonoDroid(18204):     at android.view.ViewGroup.layout(ViewGroup.java:5405)
I/MonoDroid(18204):     at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2414)
I/MonoDroid(18204):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2123)
I/MonoDroid(18204):     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1264)
I/MonoDroid(18204):     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6943)
I/MonoDroid(18204):     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
I/MonoDroid(18204):     at android.view.Choreographer.doCallbacks(Choreographer.java:590)
I/MonoDroid(18204):     at android.view.Choreographer.doFrame(Choreographer.java:560)
I/MonoDroid(18204):     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
I/MonoDroid(18204):     at android.os.Handler.handleCallback(Handler.java:739)
I/MonoDroid(18204):     at android.os.Handler.dispatchMessage(Handler.java:95)
I/MonoDroid(18204):     at android.os.Looper.loop(Looper.java:145)
I/MonoDroid(18204):     at android.app.ActivityThread.main(ActivityThread.java:6837)
I/MonoDroid(18204):     at java.lang.reflect.Method.invoke(Native Method)
I/MonoDroid(18204):     at java.lang.reflect.Method.invoke(Method.java:372)
I/MonoDroid(18204):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
I/MonoDroid(18204):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
4

0 回答 0