ViewPagerIndicator.CirclePageIndicator在OnSaveInstanceState中崩溃

时间:2016-10-27 10:03:41

标签: android android-viewpager xamarin.android android-lifecycle

所以我使用ViewPager和CirclePageIndicator进行此活动。 问题是如果我从这个页面拨打电话,活动会在OnSaveInstanceState中崩溃。

该日志包含以下消息:System.MethodAccessException: Method '(wrapper dynamic-method) object:dynamic_callback_0 (intptr,intptr)' is inaccessible from method 'ViewPagerIndicator.CirclePageIndicator/SavedState:InitializeCreator ()'

页面非常简单:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/transparent">
    (...)
    <android.support.v4.view.ViewPager
        android:id="@+id/advicesViewPager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="@android:color/transparent" />
    <viewpagerindicator.CirclePageIndicator
        android:layout_width="match_parent"
        android:layout_weight="0"
        android:layout_height="20dp"
        android:id="@+id/pageIndicator"
        android:layout_gravity="bottom"
        android:layout_marginBottom="5dip"
        android:background="@android:color/transparent" />
</LinearLayout>

现在我在OnSaveInstanceState中没有做任何具体的事情:

protected override void OnSaveInstanceState(Bundle outState) {
    base.OnSaveInstanceState(outState);
}

有没有人有想法?它是ViewPager中的错误吗? 这是更完整的崩溃日志:

10-27 11:27:39.397: I/MonoDroid(21152): UNHANDLED EXCEPTION:
10-27 11:27:39.412: I/MonoDroid(21152): System.MethodAccessException: Method `(wrapper dynamic-method) object:dynamic_callback_0 (intptr,intptr)' is inaccessible from method `ViewPagerIndicator.CirclePageIndicator/SavedState:InitializeCreator ()'
10-27 11:27:39.412: I/MonoDroid(21152):   at (wrapper managed-to-native) Java.Interop.NativeMethods:java_interop_jnienv_alloc_object (intptr,intptr&,intptr)
10-27 11:27:39.412: I/MonoDroid(21152):   at Java.Interop.JniEnvironment+Object.AllocObject (Java.Interop.JniObjectReference type) [0x0002b] in <6404a45abb2c4b308b3171b7d4654a9c>:0 
10-27 11:27:39.412: I/MonoDroid(21152):   at Java.Interop.JniType.AllocObject () [0x0000d] in <6404a45abb2c4b308b3171b7d4654a9c>:0 
10-27 11:27:39.412: I/MonoDroid(21152):   at Java.Interop.JniPeerMembers+JniInstanceMethods.StartCreateInstance (System.String constructorSignature, System.Type declaringType, Java.Interop.JniArgumentValue* parameters) [0x0004e] in <6404a45abb2c4b308b3171b7d4654a9c>:0 
10-27 11:27:39.412: I/MonoDroid(21152):   at Android.Views.View+BaseSavedState..ctor (Android.OS.IParcelable superState) [0x00068] in <b89cc247a96c4a08b3f4d799211a17e9>:0 
10-27 11:27:39.412: I/MonoDroid(21152):   at ViewPagerIndicator.CirclePageIndicator+SavedState..ctor (Android.OS.IParcelable superState) [0x00000] in <6082434bddad42ed98ca380b4342ff37>:0 
10-27 11:27:39.412: I/MonoDroid(21152):   at ViewPagerIndicator.CirclePageIndicator.OnSaveInstanceState () [0x00006] in <6082434bddad42ed98ca380b4342ff37>:0 
10-27 11:27:39.413: I/MonoDroid(21152):   at Android.Views.View.n_OnSaveInstanceState (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <b89cc247a96c4a08b3f4d799211a17e9>:0 
10-27 11:27:39.413: I/MonoDroid(21152):   at (wrapper dynamic-method) System.Object:79b91d2d-6d99-430c-aadf-8224184bf0d3 (intptr,intptr)
10-27 11:27:39.635: W/google-breakpad(21152): ### ### ### ### ### ### ### ### ### ### ### ### ###
10-27 11:27:39.636: W/google-breakpad(21152): Chrome build fingerprint:
10-27 11:27:39.636: W/google-breakpad(21152): 1.0
10-27 11:27:39.636: W/google-breakpad(21152): 1
10-27 11:27:39.636: W/google-breakpad(21152): ### ### ### ### ### ### ### ### ### ### ### ### ###
10-27 11:27:39.636: E/mono-rt(21152): Stacktrace:
10-27 11:27:39.636: E/mono-rt(21152):   at <unknown> <0xffffffff>
10-27 11:27:39.636: E/mono-rt(21152):   at (wrapper managed-to-native) Java.Interop.NativeMethods.java_interop_jnienv_find_class (intptr,intptr&,string) <0x00043>
10-27 11:27:39.636: E/mono-rt(21152):   at Java.Interop.JniEnvironment/Types.FindClass (string) <0x000a7>
10-27 11:27:39.636: E/mono-rt(21152):   at Java.Interop.JniType..ctor (string) <0x0002b>
10-27 11:27:39.636: E/mono-rt(21152):   at Java.Interop.JniPeerMembers/JniInstanceMethods..ctor (System.Type) <0x000eb>
10-27 11:27:39.636: E/mono-rt(21152):   at Java.Interop.JniPeerMembers/JniInstanceMethods.GetConstructorsForType (System.Type) <0x00097>
10-27 11:27:39.636: E/mono-rt(21152):   at Java.Interop.JniPeerMembers/JniInstanceMethods.StartCreateInstance (string,System.Type,Java.Interop.JniArgumentValue*) <0x0009b>
10-27 11:27:39.636: E/mono-rt(21152):   at Java.Lang.Throwable..ctor (string) <0x0016b>
10-27 11:27:39.637: E/mono-rt(21152):   at Android.Runtime.JavaProxyThrowable..ctor (System.Exception) <0x0001f>
10-27 11:27:39.637: E/mono-rt(21152):   at Java.Lang.Throwable.FromException (System.Exception) <0x0009f>
10-27 11:27:39.637: E/mono-rt(21152):   at Android.Runtime.AndroidEnvironment.UnhandledException (System.Exception) <0x00177>
10-27 11:27:39.637: E/mono-rt(21152):   at (wrapper dynamic-method) object.79b91d2d-6d99-430c-aadf-8224184bf0d3 (intptr,intptr) <0x00063>
10-27 11:27:39.637: E/mono-rt(21152):   at (wrapper native-to-managed) object.79b91d2d-6d99-430c-aadf-8224184bf0d3 (intptr,intptr) <0x000b3>
10-27 11:27:39.637: E/mono-rt(21152):   at <unknown> <0xffffffff>
10-27 11:27:39.637: E/mono-rt(21152):   at (wrapper managed-to-native) Java.Interop.NativeMethods.java_interop_jnienv_call_nonvirtual_void_method_a (intptr,intptr&,intptr,intptr,intptr,Java.Interop.JniArgumentValue*) <0x00057>
10-27 11:27:39.637: E/mono-rt(21152):   at Java.Interop.JniEnvironment/InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference,Java.Interop.JniObjectReference,Java.Interop.JniMethodInfo,Java.Interop.JniArgumentValue*) <0x000ab>
10-27 11:27:39.637: E/mono-rt(21152):   at Java.Interop.JniPeerMembers/JniInstanceMethods.InvokeVirtualVoidMethod (string,Java.Interop.IJavaPeerable,Java.Interop.JniArgumentValue*) <0x00133>
10-27 11:27:39.637: E/mono-rt(21152):   at Android.App.Activity.OnSaveInstanceState (Android.OS.Bundle) <0x0014b>
10-27 11:27:39.637: E/mono-rt(21152):   at WheezMe.Droid.WheezHelpAdvicesActivity.OnSaveInstanceState (Android.OS.Bundle) <0x0001b>
10-27 11:27:39.637: E/mono-rt(21152):   at Android.App.Activity.n_OnSaveInstanceState_Landroid_os_Bundle_ (intptr,intptr,intptr) <0x0005b>
10-27 11:27:39.637: E/mono-rt(21152):   at (wrapper dynamic-method) object.de7a5f24-dc6e-4938-89c6-95b6aa716a51 (intptr,intptr,intptr) <0x00043>
10-27 11:27:39.637: E/mono-rt(21152):   at (wrapper native-to-managed) object.de7a5f24-dc6e-4938-89c6-95b6aa716a51 (intptr,intptr,intptr) <0x000b3>
10-27 11:27:39.637: E/mono-rt(21152): Attempting native Android stacktrace:

提前致谢

1 个答案:

答案 0 :(得分:1)

似乎是CirclePageIndicator中的错误。可能与this one相关联。 如果我设置

pageIndicator.SaveEnabled = false; 

然后崩溃不再发生