google / flutter.plugins

BSD 3-Clause "New" or "Revised" License
117 stars 55 forks source link

Crash : android.app.ActivityThread$H.handleMessage (ActivityThread.java:2188) #95

Open arodriguezgb opened 3 years ago

arodriguezgb commented 3 years ago

Hey guys, I installed crashalytics and was able to find more about this crash. Its about the notification, more closely the .setShowActionsInCompactView().

Screen Shot 2021-01-30 at 3 15 27 PM

This line here: Screen Shot 2021-01-30 at 3 16 23 PM

I found more info about it here https://stackoverflow.com/questions/47920158/java-lang-illegalargumentexception-setshowactionsincompactview-action-1-out-of and here https://github.com/tanguyantoine/react-native-music-control/issues/230

Here is a bit of an explanation of what could be happening. Screen Shot 2021-01-30 at 3 20 45 PM

I am not very knowledgable on Java, so Im not perfectly sure how to help but maybe others can help so we can eliminate this crash from this helpful plugin.

Edit: Changing this .setShowActionsInCompactView(compactNotificationActionIndices) to this .setShowActionsInCompactView(0) crashes the app on startup with the exact crash that Ive seen reported on the developer console.

So im thinking there is something with with the logic of the compactIndices that in certain scenarios it makes the app crash.

monkeyswarm commented 3 years ago

Ok, the possibility is that your app code calling AudioSystem.setAndroidMediaButtons, is being set (to a one-element array, with the sole value of zero), but no actions are being defined. i.e.

AudioSystem.instance.setAndroidNotificationButtons(<dynamic>[], 
    androidCompactIndices: <int>[0]);

When I do that, I get the same stack trace.

02-06 11:15:51.578 1966 1966 E StatusBar: java.lang.IllegalArgumentException: setShowActionsInCompactView: action 0 out of bounds (max -1)

Is this a possible issue in your app?

arodriguezgb commented 3 years ago

@monkeyswarm

Not sure, I actually set them like the tutorial / example suggests. I have certain scenarios but its never empty, its PAUSE / PLAY or PAUSE / PLAY FORWARD BACKWARDS. But i can take a look to see if theres a possibility where theres an empty action somewhere.

Here is a screenshots of some of the scenarios. Maybe "m doing this wrong and its what's causing the issue.

Screen Shot 2021-02-06 at 6 12 57 PM