帖子图片详情中多次弹出/隐藏CommentDialog再点击录制按钮奔溃

来源:9-13 帖子互动玩法升级

JefferyzZ

2023-11-08

报错信息如下:

Process: com.techme.jetpack, PID: 30688
                                                                                                    java.lang.IllegalStateException: Attempting to launch an unregistered ActivityResultLauncher with contract androidx.activity.result.contract.ActivityResultContracts$StartActivityForResult@789d537 and input Intent { cmp=com.techme.jetpack/.pages.publish.CaptureActivity }. 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.techme.jetpack.pages.detail.CommentDialog.onViewCreated$lambda$1(CommentDialog.kt:112)
                                                                                                    	at com.techme.jetpack.pages.detail.CommentDialog.$r8$lambda$ZaVMjHhIkjc85vAlvtm6ytO5-4I(Unknown Source:0)
                                                                                                    	at com.techme.jetpack.pages.detail.CommentDialog$$ExternalSyntheticLambda0.onClick(Unknown Source:2)
                                                                                                    	at android.view.View.performClick(View.java:7506)
                                                                                                    	at android.view.View.performClickInternal(View.java:7483)
                                                                                                    	at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
                                                                                                    	at android.view.View$PerformClick.run(View.java:29334)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:942)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:201)
                                                                                                    	at android.os.Looper.loop(Looper.java:288)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:7872)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

老师,有空可以帮忙看看

写回答

1回答

LovelyChubby

2023-11-09

java.lang.IllegalStateException: Attempting to launch an unregistered ActivityResultLauncher with contract androidx.activity.result.contract.ActivityResultContracts$StartActivityForResult@789d537 and input Intent { cmp=com.techme.jetpack/.pages.publish.CaptureActivity }. 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.techme.jetpack.pages.detail.CommentDialog.onViewCreated$lambda$1(CommentDialog.kt:112)



报错信息很明显的重复注册了,注册之前先反注册一下
0
0

全新版Jetpack进阶提升,系统性落地短视频App

全新版Jetpack进阶提升,系统性落地短视频App

345 学习 · 117 问题

查看课程