Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android icon - Crash appearing in crashalytics #895

Open
yringler opened this issue Jan 7, 2022 · 11 comments · May be fixed by #896
Open

android icon - Crash appearing in crashalytics #895

yringler opened this issue Jan 7, 2022 · 11 comments · May be fixed by #896

Comments

@yringler
Copy link
Contributor

yringler commented Jan 7, 2022

Documented behaviour

MediaControl.androidIcon

Actual behaviour

Crash

Runtime error

Fatal Exception: java.lang.NoSuchMethodError: No static method h(Landroid/content/res/Resources;Ljava/lang/String;I)Landroidx/core/graphics/drawable/IconCompat; in class Landroidx/core/graphics/drawable/IconCompat; or its super classes (declaration of 'androidx.core.graphics.drawable.IconCompat' appears in /data/app/~~_RcnCR0OtbJmY6pt9Y5eoQ==/androidx.test.tools.crawler-5YLxh2u69guHW7GNnn2Oyg==/base.apk)
       at androidx.core.app.NotificationCompat$Action.<init>(NotificationCompat.java:6)
       at com.ryanheise.audioservice.AudioService.createAction(AudioService.java:10)
       at com.ryanheise.audioservice.AudioService.setState(AudioService.java:60)
       at com.ryanheise.audioservice.AudioServicePlugin$AudioHandlerInterface.onMethodCall(AudioServicePlugin.java:469)
       at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:17)
       at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:18)
       at io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart$0(DartMessenger.java:20)
       at io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart$0$DartMessenger(DartMessenger.java)
       at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$6ZD1MYkhaLxyPjtoFDxe45u43DI.run(-.java:12)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7664)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Minimal reproduction project

https://github.com/yringler/inside-app

Reproduction steps

N/A

Output of flutter doctor

TODO

Devices exhibiting the bug

Android only
8.0.0 Galaxy S9 (2 times)
9 Pixel 3 (2 times)
11 Pixel 5 (2 times)
10 Galaxy S20 5G (2 times)

@ryanheise
Copy link
Owner

One thing it might be is this commit:

6c29b4c#diff-c86bb6d0df8057eadc2afad5f1530768eb9e001425e99a9b27ebf71fcfebc79d

where the androidx.media:media dependency was removed. Since it didn't cause a build error at the time, this wasn't flagged, but it's possibly this that is now showing up as a runtime error.

@yringler
Copy link
Contributor Author

yringler commented Jan 7, 2022

Ah, so you mean removing androidx.media:media wasn't necessarily super intentional?
I haven't had a chance to try to reproduce the error, but is it worth it to add that dependency back and see if I stop seeing the crash?

I have a lot of balls in the air, a reason why I haven't focused on this properly yet. It happens to be a very busy time in my app development, There's been several public, beta, and internal releases in the last few weeks, but all app versions have the latest audio service - I had to upgrade because of android 12. #836

Just noticed that this crash has only been reported on versions of the app in internal testing.
Which is strange, because it's a large variety of devices, and only one person should have access to internal testing, and he hasn't reported anything.

I have emulators I use during development, but only 2, and I haven't seen any crashes, and I don't think any of these are my type of device.

@ryanheise
Copy link
Owner

Ah, so you mean removing androidx.media:media wasn't necessarily super intentional?
I haven't had a chance to try to reproduce the error, but is it worth it to add that dependency back and see if I stop seeing the crash?

Definitely that would be the first thing to try. Is there any other information you can provide about your build process for Android? I assume this is a release build, but how was that release build built? E.g. APK / app bundle, obfuscation, anything special in build.gradle, other gradle or pub dependencies that might transitively depend on conflicting media dependencies, etc.

Also reproducing it is important in order to know for sure whether the fixes it. If you want to just try that proposed change and see how it goes, maybe that will be easier for you.

@yringler
Copy link
Contributor Author

yringler commented Jan 9, 2022

Edit: happened in public beta

@yringler
Copy link
Contributor Author

yringler commented Jan 9, 2022

where the androidx.media:media dependency was removed

I still see the dependency in that commit and master?

@ryanheise
Copy link
Owner

Sorry, I think I meant androids.core:core.

@yringler
Copy link
Contributor Author

yringler commented Jan 9, 2022

I build with code magic, an app bundle and APK
I don't think I have anything special in my build.gradle
All the stuff is here

Sorry, I think I meant androids.core:core.

Ah, ok. I may just add that back and see if I stop seeing errors.
Haven't been able to replicate yet.

@yringler yringler linked a pull request Jan 9, 2022 that will close this issue
8 tasks
@yringler
Copy link
Contributor Author

yringler commented Jan 9, 2022

Haven't been able to replicate - tried same build, same device (browserstack - free open source license), no dice 😬
I've never been so nervous not to see a crash 😆
Big release coming up this week.

@ryanheise
Copy link
Owner

It is a strange one because it appears that the same build is sometimes working and sometimes not. Perhaps this has to do with the way Android libraries are loaded and that maybe they are loaded in different ways at different times. For example, if the entry point is the main activity or if the entry point is from a background trigger. Do you have test cases for each?

@yringler
Copy link
Contributor Author

yringler commented Jan 9, 2022

Do you have test cases for each?

I... don't have test cases
Very embarrassing.

I could try a background trigger, but not sure what that means.
That would be for example, if I play audio, kill the app, and then click the notification?

@ryanheise
Copy link
Owner

Yes, although I guess that scenario would behave differently pre and post Android 11, so I'm not 100% if it will lead to anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants