TeamAmaze / TeamAmaze/AmazeFileManager

`IllegalStateException: MainFragment not attached to an activity` on `MainFragment#requireMainActivity`

Open
#3,380 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

From-Email Issue-Bug
Dominant language
Kotlin
Stars
6.4k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
1

Description

Issue explanation (write below this line)

Exception

  • App Name: Amaze File Manager
  • Package: com.amaze.filemanager
  • Version: 3.7.2
  • User Action: UI Error
  • Request: Application crash
  • OS: Linux
    OnePlus/Nord_IND/Nord:12/RKQ1.211119.001/Q.202204221830:user/release-keys
    12 - 31
  • Device: Nord
  • Model: AC2001
  • Product: Nord_IND
Crash log

java.lang.IllegalStateException: Fragment MainFragment{ab62edc}
(3055c974-b0c2-432f-84b1-af205a39b0e7) not attached to an activity.
at androidx.fragment.app.Fragment.requireActivity(Fragment.java:928)
at
com.amaze.filemanager.ui.fragments.MainFragment.requireMainActivity(MainFragment.java:1455)
at
com.amaze.filemanager.ui.fragments.MainFragment.lambda$reloadListElements$10(MainFragment.java:824)
at
com.amaze.filemanager.ui.fragments.MainFragment.$r8$lambda$0wAQ1XXPhLLIZ_Zjw1OviROGgjk(Unknown
Source:0)
at
com.amaze.filemanager.ui.fragments.MainFragment$$ExternalSyntheticLambda12.run(Unknown
Source:2)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:233)
at android.os.Looper.loop(Looper.java:344)
at android.app.ActivityThread.main(ActivityThread.java:8210)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)


Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in MainFragment at requireMainActivity (line 1455) and reloadListElements (line 824), then trace the Handler callback shown in the crash log. Reproduce the lifecycle case where the fragment is detached and verify that the delayed callback no longer produces IllegalStateException.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.