gpt4 book ai didi

在 LG 4G Stylus 上拍照后 Android 应用程序崩溃 "Unable to find the default constructor"

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:02:11 24 4
gpt4 key购买 nike

我的应用程序在 LG 4G Stylus 设备上拍照后崩溃。它在 Galaxy nexus、Galaxy S4、LG 4G 上运行良好。

我不能 Handlebars 指放在上面,这让我发疯......

我正在为我的图像使用 viewpager 并使用这些 list 配置:

<activity android:name="easydeal_android.MainActivity" android:configChanges="orientation|screenSize" android:windowSoftInputMode="adjustPan|stateHidden">

如果有人能帮助我,我将不胜感激!

这里是异常:Caused by: md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: System.NotSupportedException: Unable to find the default constructor on type EasyDeal_Android.FragmentDetailsVehicle.请提供缺少的构造函数。 ---> Java.Interop.JavaLocationException:抛出了“Java.Interop.JavaLocationException”类型的异常。

这是痕迹:

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
... 1 more
Caused by: md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: System.NotSupportedException: Unable to find the default constructor on type EasyDeal_Android.FragmentDetailsVehicle. Please provide the missing constructor. ---> Java.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown.
Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.
--- End of managed exception stack trace ---
java.lang.Error: Java callstack:
at mono.android.TypeManager.n_activate(Native Method)
at mono.android.TypeManager.Activate(TypeManager.java:7)
at md56d2061e530d4ae630a81127536162064.FragmentDetailsVehicle.<init>(FragmentDetailsVehicle.java:27)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1572)
at android.app.Fragment.instantiate(Fragment.java:611)
at android.app.FragmentState.instantiate(Fragment.java:104)
at android.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:1775)
at android.app.Activity.onCreate(Activity.java:946)
at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:257)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:58)
at md56d2061e530d4ae630a81127536162064.MainActivity.n_onCreate(Native Method)
at md56d2061e530d4ae630a81127536162064.MainActivity.onCreate(MainActivity.java:36)
at android.app.Activity.performCreate(Activity.java:6021)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2405)
at android.app.ActivityThread.access$800(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1323)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5376)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
--- End of inner exception stack trace ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00028>
at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue*) <0x000e7>
at Android.App.Activity.OnCreate (Android.OS.Bundle) <0x001cb>
at EasyDeal_Android.MainActivity.OnCreate (Android.OS.Bundle) <0x0001f>
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <0x0005b>
at (wrapper dynamic-method) object.1f7fe7fe-50ae-47b3-b6d7-d47312e8dfe6 (intptr,intptr,intptr) <0x00043>
at md56d2061e530d4ae630a81127536162064.MainActivity.n_onCreate(Native Method)
at md56d2061e530d4ae630a81127536162064.MainActivity.onCreate(MainActivity.java:36)
at android.app.Activity.performCreate(Activity.java:6021)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2405)
at android.app.ActivityThread.access$800(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1323)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5376)
... 4 more

编辑:

它确实解决了问题,但在拍了不止一张照片后它仍然崩溃了:

10-23 15:57:56.783   839  1707 I WindowState: WIN DEATH: Window{2380813b u0 adnt.easydeal/md56d2061e530d4ae630a81127536162064.MainActivity}
10-23 15:57:56.793 839 1682 I ActivityManager: Process adnt.easydeal (pid 2787) has died
10-23 15:57:56.793 839 1682 W ActivityManager: Force removing ActivityRecord{2e8c2d28 u0 adnt.easydeal/md56d2061e530d4ae630a81127536162064.MainActivity t2019}: app died, no saved state

最佳答案

似乎您在 FragmentDetailsVehicle 类中获得了自定义构造函数,但您还需要手动添加默认构造函数,即使它实际上什么都不做:

public FragmentDetailsVehicle() {}

参见:https://developer.android.com/reference/android/app/Fragment.html

All subclasses of Fragment must include a public no-argument constructor. The framework will often re-instantiate a fragment class when needed, in particular during state restore, and needs to be able to find this constructor to instantiate it. If the no-argument constructor is not available, a runtime exception will occur in some cases during state restore.

关于在 LG 4G Stylus 上拍照后 Android 应用程序崩溃 "Unable to find the default constructor",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33309926/

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