audio_service icon indicating copy to clipboard operation
audio_service copied to clipboard

crashed app when change main mobile theme ( dark and light mode)

Open setayeshce opened this issue 3 years ago • 2 comments

Documented behaviour

<activity android:name="com.ryanheise.audioservice.AudioServiceActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density" android:hardwareAccelerated="true" android:requestLegacyExternalStorage="true" android:windowSoftInputMode="adjustResize" android:exported="true" android:turnScreenOn="true" tools:ignore="Instantiatable"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity>

Actual behaviour

when changing the theme, the app crashes and only when the audio service activity is defined in AndroidManifest this problem appears.

Runtime error

 FATAL EXCEPTION: main
E/AndroidRuntime( 8415): Process: com.example.example, PID: 8415
E/AndroidRuntime( 8415): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.podkadeh/com.ryanheise.audioservice.AudioServiceActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'io.flutter.plugin.common.BinaryMessenger io.flutter.embedding.engine.plugins.FlutterPlugin$FlutterPluginBinding.getBinaryMessenger()' on a null object reference
E/AndroidRuntime( 8415): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
E/AndroidRuntime( 8415): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
E/AndroidRuntime( 8415): 	at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5456)
E/AndroidRuntime( 8415): 	at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5362)
E/AndroidRuntime( 8415): 	at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69)
E/AndroidRuntime( 8415): 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime( 8415): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime( 8415): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
E/AndroidRuntime( 8415): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 8415): 	at android.os.Looper.loop(Looper.java:223)
E/AndroidRuntime( 8415): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/AndroidRuntime( 8415): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 8415): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/AndroidRuntime( 8415): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/AndroidRuntime( 8415): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'io.flutter.plugin.common.BinaryMessenger io.flutter.embedding.engine.plugins.FlutterPlugin$FlutterPluginBinding.getBinaryMessenger()' on a null object reference
E/AndroidRuntime( 8415): 	at com.crazecoder.openfile.OpenFilePlugin.onAttachedToActivity(OpenFilePlugin.java:400)
E/AndroidRuntime( 8415): 	at com.crazecoder.openfile.OpenFilePlugin.onReattachedToActivityForConfigChanges(OpenFilePlugin.java:415)
E/AndroidRuntime( 8415): 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.attachToActivityInternal(FlutterEngineConnectionRegistry.java:354)
E/AndroidRuntime( 8415): 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.attachToActivity(FlutterEngineConnectionRegistry.java:335)
E/AndroidRuntime( 8415): 	at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:188)
E/AndroidRuntime( 8415): 	at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:459)
E/AndroidRuntime( 8415): 	at android.app.Activity.performCreate(Activity.java:7994)
E/AndroidRuntime( 8415): 	at android.app.Activity.performCreate(Activity.java:7978)
E/AndroidRuntime( 8415): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
E/AndroidRuntime( 8415): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
E/AndroidRuntime( 8415): 	... 13 more
I/Process ( 8415): Sending signal. PID: 8415 SIG: 9
Lost connection to device.

Minimal reproduction project

Official example: AndroidManifest.xml

Reproduction steps

  1. lunch app on android device with audio service initiated
  2. change mobile theme
  3. app crashes

Output of flutter doctor

[√] Flutter (Channel stable, 2.10.5, on Microsoft Windows [Version 10.0.19044.1706], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.67.2)
[√] Connected device (4 available)
[√] HTTP Host Availability

Devices exhibiting the bug

android all that I have tested 12, 11, 10, 9

setayeshce avatar May 22 '22 08:05 setayeshce

Thanks for the report! I will check later to see if I can reproduce it.

ryanheise avatar May 22 '22 08:05 ryanheise

@ryanheise thanks, were you able to reproduce the bug? is there anything I can help you with?

setayeshce avatar May 31 '22 09:05 setayeshce