Android App crashes on back button press

gui
#1

So far everything is working for me on android right now… except it crashes when I press the back button to close the app or do anything else.
It gives me the following error: com.roli.juce.JuceApp cannot be cast to android.app.Activity

The complete console output is:

2019-03-03 00:40:14.794 24523-24523/com.dustvoice.communicare_ev.client E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.dustvoice.communicare_ev.client, PID: 24523
    java.lang.ClassCastException: com.roli.juce.JuceApp cannot be cast to android.app.Activity
        at com.roli.juce.ComponentPeerView.onKeyDown(ComponentPeerView.java:243)
        at android.view.KeyEvent.dispatch(KeyEvent.java:2688)
        at android.view.View.dispatchKeyEvent(View.java:11712)
        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1822)
        at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4768)
        at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4640)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4175)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4228)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4194)
        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4321)
        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4202)
        at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4378)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4175)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4228)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4194)
        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4202)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4175)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4228)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4194)
        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4354)
        at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:4515)
        at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2465)
        at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2028)
        at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2019)
        at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2442)
        at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
        at android.os.MessageQueue.nativePollOnce(Native Method)
        at android.os.MessageQueue.next(MessageQueue.java:325)
        at android.os.Looper.loop(Looper.java:142)
        at android.app.ActivityThread.main(ActivityThread.java:6798)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
0 Likes

#2

This was reported in https://github.com/WeAreROLI/JUCE/issues/492 and fixed on the develop branch in https://github.com/WeAreROLI/JUCE/commit/6eab395204353d087a2ba4404dfbfa0f270aa319.

1 Like

#3

Yep, I’ll cherry pick that onto master too.

0 Likes