gpt4 book ai didi

android - fragment $InstantiationException | Google Play 控制台上的 NoSuchMethodException

转载 作者:行者123 更新时间:2023-12-04 11:40:09 31 4
gpt4 key购买 nike

根据一些答案,已向 Fragments 添加了默认构造函数,但我们仍然在播放控制台上遇到崩溃。

  java.lang.RuntimeException: 
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3488)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3635)
at android.app.ActivityThread.handleRelaunchActivityInner (ActivityThread.java:5582)
at android.app.ActivityThread.handleRelaunchActivity (ActivityThread.java:5490)
at android.app.servertransaction.ActivityRelaunchItem.execute (ActivityRelaunchItem.java:69)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2175)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at android.app.ActivityThread.main (ActivityThread.java:7860)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1075)
Caused by: androidx.fragment.app.Fragment$InstantiationException:
at androidx.fragment.app.Fragment.instantiate (Fragment.java:94)
at androidx.fragment.app.FragmentContainer.instantiate (FragmentContainer.java)
at androidx.fragment.app.FragmentManager$3.instantiate (FragmentManager.java:9)
at androidx.fragment.app.FragmentStateManager.<init> (FragmentStateManager.java:10)
at androidx.fragment.app.FragmentManager.restoreSaveState (FragmentManager.java:96)
at androidx.fragment.app.FragmentController.restoreSaveState (FragmentController.java:8)
at androidx.fragment.app.FragmentActivity.onCreate (FragmentActivity.java:17)
at androidx.appcompat.app.AppCompatActivity.onCreate (AppCompatActivity.java:10)
at com.companyname.activities.BaseActivity.onCreate (BaseActivity.java)
at com.companyname.activities.Activity1.onCreate (Activity1.java)
at android.app.Activity.performCreate (Activity.java:7955)
at android.app.Activity.performCreate (Activity.java:7944)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3463)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3635)
at android.app.ActivityThread.handleRelaunchActivityInner (ActivityThread.java:5582)
at android.app.ActivityThread.handleRelaunchActivity (ActivityThread.java:5490)
at android.app.servertransaction.ActivityRelaunchItem.execute (ActivityRelaunchItem.java:69)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2175)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at android.app.ActivityThread.main (ActivityThread.java:7860)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1075)
Caused by: java.lang.NoSuchMethodException:
at java.lang.Class.getConstructor0 (Class.java:2332)
at java.lang.Class.getConstructor (Class.java:1728)
at androidx.fragment.app.Fragment.instantiate (Fragment.java:15)
at androidx.fragment.app.FragmentContainer.instantiate (FragmentContainer.java)
at androidx.fragment.app.FragmentManager$3.instantiate (FragmentManager.java:9)
at androidx.fragment.app.FragmentStateManager.<init> (FragmentStateManager.java:10)
at androidx.fragment.app.FragmentManager.restoreSaveState (FragmentManager.java:96)
at androidx.fragment.app.FragmentController.restoreSaveState (FragmentController.java:8)
at androidx.fragment.app.FragmentActivity.onCreate (FragmentActivity.java:17)
at androidx.appcompat.app.AppCompatActivity.onCreate (AppCompatActivity.java:10)
at com.companyname.activities.BaseActivity.onCreate (BaseActivity.java)
at com.companyname.activities.Activity1.onCreate (Activity1.java)
at android.app.Activity.performCreate (Activity.java:7955)
at android.app.Activity.performCreate (Activity.java:7944)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3463)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3635)
at android.app.ActivityThread.handleRelaunchActivityInner (ActivityThread.java:5582)
at android.app.ActivityThread.handleRelaunchActivity (ActivityThread.java:5490)
at android.app.servertransaction.ActivityRelaunchItem.execute (ActivityRelaunchItem.java:69)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2175)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at android.app.ActivityThread.main (ActivityThread.java:7860)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1075)

最佳答案

您是否在没有任何参数的情况下制作了构造函数?
例如,

public YourFragment() {
// Do not anything!!!
}

关于android - fragment $InstantiationException | Google Play 控制台上的 NoSuchMethodException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64764577/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com