Android 错误信息: java.lang.StackOverflowError: stack size 8MB

当你也遇到相同的错误信息,但是出现的场景或者解决方式不同的请在评论区写下你的 场景和解决方式,方便以后其他人少走弯路,在这先谢过你!!

出现的场景:ViewPager+TabLayout+Fragment
详细的错误信息:

java.lang.StackOverflowError: stack size 8MB
                      at android.view.View.invalidateInternal(View.java:13901)
                      at android.view.View.invalidate(View.java:13863)
                      at android.view.View.invalidateDrawable(View.java:18097)
                      at android.graphics.drawable.Drawable.invalidateSelf(Drawable.java:844)
                      at android.graphics.drawable.RippleDrawable.invalidateSelf(RippleDrawable.java:711)
                      at android.graphics.drawable.RippleDrawable.cancelExitingRipples(RippleDrawable.java:239)
                      at android.graphics.drawable.RippleDrawable.jumpToCurrentState(RippleDrawable.java:223)
                      at android.widget.AbsListView.jumpDrawablesToCurrentState(AbsListView.java:3542)
                      at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:6698)
                      at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:6698)
                      at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:6698)
                      at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:6698)
                      at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:6698)
android.os.TransactionTooLargeException: data parcel size 19874096 bytes
                      at android.os.BinderProxy.transactNative(Native Method)
                      at android.os.BinderProxy.transact(Binder.java:503)
                      at android.app.ActivityManagerProxy.handleApplicationCrash(ActivityManagerNative.java:5455)
                      at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:96)
                      at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
                      at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)

原因:

在fragment中
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) 
方法中加载一个布局文件View view = inflater.inflate(R.layout.fragment_home, container);中把container改成null

你可能感兴趣的:(错误信息)