Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

资源回收的时候空指针了 #31

Open
Flipped199 opened this issue May 30, 2020 · 1 comment
Open

资源回收的时候空指针了 #31

Flipped199 opened this issue May 30, 2020 · 1 comment

Comments

@Flipped199
Copy link

2020-05-30 11:16:54.573 4046-4046 E/AndroidRuntime: FATAL EXCEPTION: main
Process: xxx, PID: 4046
java.lang.RuntimeException: Unable to destroy activity {xxx/com.ess.filepicker.activity.SelectFileByScanActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean androidx.fragment.app.FragmentManagerImpl.isDestroyed()' on a null object reference
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4167)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4185)
at android.app.ActivityThread.-wrap6(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1521)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean androidx.fragment.app.FragmentManagerImpl.isDestroyed()' on a null object reference
at androidx.fragment.app.Fragment.performDetach(Fragment.java:2849)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1034)
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2659)
at androidx.fragment.app.FragmentManagerImpl.dispatchDestroy(FragmentManagerImpl.java:2644)
at androidx.fragment.app.FragmentController.dispatchDestroy(FragmentController.java:329)
at androidx.fragment.app.FragmentActivity.onDestroy(FragmentActivity.java:366)
at androidx.appcompat.app.AppCompatActivity.onDestroy(AppCompatActivity.java:233)
at com.ess.filepicker.activity.SelectFileByScanActivity.onDestroy(SelectFileByScanActivity.java:122)
at android.app.Activity.performDestroy(Activity.java:6864)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1153)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4154)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4185) 
at android.app.ActivityThread.-wrap6(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1521) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6077) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) 

@roomanl
Copy link

roomanl commented Jul 4, 2020

我改成androidx也出现这个问题了。BaseFileFragment文件onDetach方法里面childFragmentManager.set(this, null);注释即可解决

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants