FragmentManager is already executing transactions

See original GitHub issue
Caused by: java.lang.IllegalStateException: FragmentManager is already executing transactions
                                                                                     at android.app.FragmentManagerImpl.ensureExecReady(FragmentManager.java:1981)
                                                                                     at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2037)
                                                                                     at android.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:799)
                                                                                     at com.tbruyelle.rxpermissions2.RxPermissions.getRxPermissionsFragment(RxPermissions.java:54)
                                                                                     at com.tbruyelle.rxpermissions2.RxPermissions.<init>(RxPermissions.java:41)
                                                                                     at com......MessagesActivity.initViews(MessagesActivity.java:113)

in this code :

rxPermissions = new RxPermissions(this);

I don’t know exactly the reason behind this as it was working before without any issue.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:14

github_iconTop GitHub Comments

12reactions
epoolcommented, Jul 10, 2018

@leodeleon22 @chetbox now when you instantiate new RxPermissions(this) from a fragment you have to pass the fragment instance instead of the fragment’s activity. This is fixed with v0.10.2

1reaction
relaxedSoulcommented, Aug 13, 2021

Any ideas, when this bug will be fixed? This is ridicules. You have inside method RxPermission, with could accept Activity, or Fragment. But for Activity it’s crashing.

To be honest, I am not sure there is actually a fix. It is the same as calling Activity.startActivityForResult inside Fragment and wait for result in Fragment.onActivityResult.

I mean, the only solution I see is creating annotations to say IDE to count it as a warning with the message.

Just use the right methods in the right places. For me, the fix is made and I use the right constructor in the right place.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FragmentManager is already executing transactions. When is ...
I had this exception when quickly replacing 2 fragments AND using executePendingTransactions() . Without calling this there was no exception.
Read more >
Crash): FragmentManager is already executing transactions ...
When the Fragment that has react native tries to recover the state after a navigation, it tries to use the Activity FragmentManager which...
Read more >
LiveData and IllegalStateException: FragmentManager is ...
`IllegalStateException: FragmentManager is already executing transaction`. It seemed to be strange because all of unit tests in the pipeline ...
Read more >
Android : FragmentManager is already executing transactions ...
Android : FragmentManager is already executing transactions. When is it safe to initialise pager after commit?
Read more >
Error: FragmentManager is already executing transactions ...
Error : FragmentManager is already executing transactions when rotating screen or interchanging Dark/Normal mode - Android Studio - ViewPager2 + ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found