Yalantis / uCrop

Image Cropping Library for Android
https://yalantis.com/blog/introducing-ucrop-our-own-image-cropping-library-for-android/
11.89k stars 2.16k forks source link

NullPointerException at onPrepareOptionsMenu #313

Closed bloomer20102011 closed 6 years ago

bloomer20102011 commented 7 years ago

Do you want to request a feature or report a bug? bug What is the current behavior?

What is the expected behavior?

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

Please attach any image files, URL and stack trace that can be used to reproduce the bug.

Which versions of uCrop, and which Android API versions are affected by this issue? Did this work in 2.2.1 api level 4.2.2 api 17 device was Y511-U30 HUAWEI previous versions of uCrop?

stackTrace Fatal Exception: java.lang.NullPointerException at com.yalantis.ucrop.UCropActivity.onPrepareOptionsMenu(UCropActivity.java:149) at android.app.Activity.onPreparePanel(Activity.java:2526) at android.support.v4.app.FragmentActivity.onPrepareOptionsPanel(FragmentActivity.java:535) at android.support.v4.app.FragmentActivity.onPreparePanel(FragmentActivity.java:523) at android.support.v7.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:103) at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.onPreparePanel(AppCompatDelegateImplBase.java:362) at android.support.v7.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:103) at android.support.v7.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:567) at android.support.v7.app.ToolbarActionBar$ToolbarCallbackWrapper.onCreatePanelView(ToolbarActionBar.java:580) at android.support.v7.app.AppCompatDelegateImplV9.preparePanel(AppCompatDelegateImplV9.java:1335) at android.support.v7.app.AppCompatDelegateImplV9.onKeyDownPanel(AppCompatDelegateImplV9.java:1475) at android.support.v7.app.AppCompatDelegateImplV9.onKeyDown(AppCompatDelegateImplV9.java:991) at android.support.v7.app.AppCompatDelegateImplV9.dispatchKeyEvent(AppCompatDelegateImplV9.java:958) at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:318) at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:59) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1871) at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:4118) at android.view.ViewRootImpl.deliverKeyEvent(ViewRootImpl.java:4036) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3526) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4783) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4743) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4895) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:179) at android.os.MessageQueue.nativePollOnce(MessageQueue.java) at android.os.MessageQueue.next(MessageQueue.java:128) at android.os.Looper.loop(Looper.java:151) at android.app.ActivityThread.main(ActivityThread.java:5392) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) at dalvik.system.NativeStart.main(NativeStart.java)

Legementarion commented 6 years ago

@bloomer20102011 Hello, its very unusual bug, I think it depend on device. Maybe device cant inflate some resource. Instead of UcropActivity try to use UcropFragment, this feature avalible at last release -2.2.2