TeamAmaze / TeamAmaze/AmazeFileManager

`IllegalStateException`: Attempting to launch an unregistered `ActivityResultLauncher`

Open
#4,317 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Sharing Issue-Bug Issue-Easy (good first issue)
Dominant language
Kotlin
Stars
6.4k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
1

Description

Exception

App Name: Amaze File Manager
Version: 3.10
User Action: UI Error
Request: Application crash
OS: Linux Android 11 - 30
Device: Google Nexus 4

crash log
java.lang.IllegalStateException: Attempting to launch an unregistered ActivityResultLauncher with contract androidx.activity.result.contract.ActivityResultContracts$StartActivityForResult@26ceea5 and input Intent { act=android.intent.action.OPEN_DOCUMENT_TREE (has extras) }. You must ensure the ActivityResultLauncher is registered before calling launch().
        at androidx.activity.result.ActivityResultRegistry$2.launch(ActivityResultRegistry.java:168)
        at androidx.fragment.app.Fragment$10.launch(Fragment.java:3612)
        at androidx.activity.result.ActivityResultLauncher.launch(ActivityResultLauncher.java:47)
        at com.amaze.filemanager.ui.fragments.MainFragment.lambda$loadPathInQ$4$com-amaze-filemanager-ui-fragments-MainFragment(MainFragment.java:731)
        at com.amaze.filemanager.ui.fragments.MainFragment$$ExternalSyntheticLambda13.run(Unknown Source:4)
        at com.amaze.filemanager.ui.ExtensionsKt.runIfDocumentsUIExists(Extensions.kt:124)
        at com.amaze.filemanager.ui.fragments.MainFragment.lambda$loadPathInQ$5$com-amaze-filemanager-ui-fragments-MainFragment(MainFragment.java:728)

        at com.amaze.filemanager.ui.fragments.MainFragment$$ExternalSyntheticLambda7.onClick(Unknown Source:6)

        at android.view.View.performClick(View.java:7448)

        at android.view.View.performClickInternal(View.java:7425)

        at android.view.View.access$3600(View.java:810)
        at android.view.View$PerformClick.run(View.java:28305)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

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 at MainFragment lines 728 and 731, where the OPEN_DOCUMENT_TREE intent is launched, and inspect Extensions.kt line 124 and the ActivityResultRegistry stack trace. Trace when the ActivityResultLauncher is registered relative to this click path. Done means the launcher is registered before launch and this crash no longer occurs.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.