Tau: Production NullPointerException with 3.1.10

Created on 23 Apr 2020  ยท  74Comments  ยท  Source: Canardoux/tau

Version of flutter_sound

3.1.10

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[โˆš] Flutter (Channel beta, v1.14.6, on Microsoft Windows [Version 10.0.18363.778], locale en-US)
[โˆš] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[โˆš] Android Studio (version 3.6)
[โˆš] VS Code (version 1.44.2)
[โˆš] Connected device (1 available)
โ€ข No issues found!

Platforms you faced the error (IOS or Android or both?)

Android

Expected behavior

No production errors

Actual behavior

Crashes in production (exceptionally high percentage). Crash logs always state the below exception. Only happens on Android 9 and 10 (most on Android 10). I can't reproduce the error locally on Android 9 or 10.

Caused by: java.lang.NullPointerException:
at com.dooboolab.fluttersound.BackgroundAudioService.b (BackgroundAudioService.java:68)
at com.dooboolab.fluttersound.BackgroundAudioService.onCreate (BackgroundAudioService.java:6)
at android.app.ActivityThread.handleCreateService (ActivityThread.java:3965)
at android.app.ActivityThread.access$1500 (ActivityThread.java:225)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1881)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:359)
at android.app.ActivityThread.main (ActivityThread.java:7418)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:935)

Tested environment (Emulator? Real Device?)

Real devices in production.

Steps to reproduce the behavior

No idea

bug

All 74 comments

This is bad ๐Ÿ‘Ž . Really bad ๐Ÿ‘Ž
We are currently fighting with this bug for one or two weeks
Are you sure to use 3.1.10 ? (I added a patch 3.1.10 to avoid the crash)

Unfortunately yes, I went from version 1.5.2 to version 3.1.8 which caused the error to show up. Immediately after that release I've updated to 3.1.10 in the hope the exception would disappear but unfortunately it shows up a lot in the error logs. I double checked the flutter sound version and the production release version which has flutter sound 3.1.10.
Any idea what's causing it?

I am going to look to this issue which is really serious.
My actual idea is that flutter_sound module is not yet completely initialized when the App try to start a player.
Either the App does not call initialize(), or it calls initialize() without waiting the Future to be completed. (If initialize() does not return a future, this is bad).
I will look to this issue soon. Probably in a few days. In the mean time, you could try to initialize your module earlier, and tell us if that solves this issue.

The flutter_sound module is used as an input method for the app. A user can select to give audio input which will popup the flutter sound module and only calls initialize at that moment. It also allows the user to immediately start recording, maybe I can add a timer between the initialize and start of the recording to give it time to initialize. I'll try to add it to the app however I will only have feedback on if this fixes the issue when the crash reports start coming through, which normally has a delay of around 2-3 days.
Thanks for the quick responses! I'll keep you updated once I have some more information regarding the changes.

Looking to your logs, it seems that the crash occurs during playback (startPlayerFromTrack())
not during recording.

Ah, didn't notice, thanks. After the recording the user can press play to check the recording, apparently something goes wrong in that process.

I looked to your issue, but I do not know what to do.
The bug you have is not #296, (as I thought) and I have no clue to understand your crashes. I will need more logs, but I understand that you are in production, and not easy to have logs.

There are a number of race conditions in the 3.0 code base so I'm not surprised to see this type of error.
In particular the code allows you take actions against a player before its fully initialised. This is an architectural issue with 3.0.
I've re-architectures how the dart code interacts with the java code in the 5.0 release and resolved a whole class of these issues.

I do am afraid I might have to disappoint a bit. I was able to push an update yesterday where version 4.0.1+1 has been implemented (just an hour or so after the release), changed the code to fully mimic the example and the crash reports are already starting to drip in for this new update (have only launched to a small percentage of users, not 100%).

java.lang.RuntimeException:
at android.app.ActivityThread.handleCreateService (ActivityThread.java:4082)
at android.app.ActivityThread.access$1800 (ActivityThread.java:231)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1968)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7682)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:516)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:950)
Caused by: java.lang.NullPointerException:
at com.dooboolab.fluttersound.BackgroundAudioService.b (BackgroundAudioService.java:68)
at com.dooboolab.fluttersound.BackgroundAudioService.onCreate (BackgroundAudioService.java:6)
at android.app.ActivityThread.handleCreateService (ActivityThread.java:4070)
at android.app.ActivityThread.access$1800 (ActivityThread.java:231)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1968)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7682)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:516)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:950)

Percentage wise this is by far the biggest crash received in the Dev Console, and above the normal median.

Not sure how I can help, only statistics I can give is:

  • Only happening on Android 9 and 10
  • Happens on a lot of different devices from different manufacturers
  • Crash started to happen when going from 1.5.2 to version 3.1.8 and still happening at 4.0.1+1

This is bad news ๐Ÿ‘Ž
I am going to look to this bug tomorrow.
We are sorry that you get those problems ๐Ÿ‘Ž

Don't worry, it's an amazing library. Thanks for all the work you guys have put into it ๐Ÿ‘
I'll wait for a few days and otherwise return to 1.5.2 for a while, which is fine as well.

I am going to sleep, now. I will work on that tomorrow.
In the mean time, could you check that you do not try to startPlayerFromTrack() on a FlutterSoundPlayer not completely initialized ?

You must be certain that your module is initialized before trying to play.
You must await :

mySoundPlayer = await TrackPlayer().initialize();

Before every play the following is run:

await flutterSoundPlayer.initialize();
await flutterSoundPlayer.startPlayer(this.path);
await flutterSoundPlayer.setVolume(1.0);
_playerSubscription = flutterSoundPlayer.onPlayerStateChanged.listen ...

For stop:

await flutterSoundPlayer.stopPlayer();
_playerSubscription.cancel();

And on dispose:
flutterSoundPlayer.release();

Just noticed the setVolume is being done after the startPlayer, do you think that could be the issue? I can't easily push an update every two days, so unless you think it might be the issue I'd rather not yet try to change it.
If you want to know the code used for the recording let me know and I'll post it as well.

Thanks for the help!

I suspect that your problem is the fact that the 3.0 branch doesn't
correctly initialise the media player.
The 5.0 dev branch includes logic that ensures that the media player is
fully initialised.
In testing with 3.0 about 1 in 4 times I can produce a crash due to the
initialisation problem.
I'm unable to reproduce any crashes in the 5.0 branch.

On Mon, 27 Apr 2020 at 09:27, Sander876 notifications@github.com wrote:

Before every play the following is run:

await flutterSoundPlayer.initialize();
await flutterSoundPlayer.startPlayer(this.path);
await flutterSoundPlayer.setVolume(1.0);
_playerSubscription = flutterSoundPlayer.onPlayerStateChanged.listen ...

For stop:
await flutterSoundPlayer.stopPlayer();
_playerSubscription.cancel();

And on dispose:
flutterSoundPlayer.release();

Just noticed the setVolume is being done after the startPlayer, do you
think that could be the issue? I can't easily push an update every two
days, so unless you think it might be the issue I'd rather not yet try to
change it.
If you want to know the code used for the recording let me know and I'll
post it as well.

Thanks for the help!

โ€”
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/dooboolab/flutter_sound/issues/317#issuecomment-619641404,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAG32OCWI4USGKRADIO4G6DROS7NLANCNFSM4MORTUTA
.

Interesting, I assume version 4.0.1+1 doesn't have the same logic yet as the 5.0 branch? Any rough estimation when the 5.0 branch goes to production?
Thanks!

No 4.0 has the same problems as 3.x.

@Larpoux is currently reviewing the 5.0 code.

I'm hopeful we can get a beta out this week but it does have a fair no. of breaking changes.
Having said that I've converted one of my widgets and it only took me a few minutes.

I completely disagree with @bsbutton :
Maintenance and development are two different things.
It is totally irresponsible to suggest to use a dev version to a user having bugs in a released version.

Maintenance is done using patches, not new development.
This is the only way to have a product being more and more stable and bug free.
Of course, an eventual new V5.0.0 will have (at least) 10 times more bugs than the current released version. This is definitely not possible for @Sander876 to consider switching to a dev version because he has bug in the current released version.

I'll wait for a few days and otherwise return to 1.5.2 for a while, which is fine as well.

@Sander876 : I am going to look to your bug.
But I do not think that returning back to 1.x.x is a good solution for you.
This very old version does not have the TrackPlayer feature.
So if you do not need this feature, I think better for you to use the FlutterSoundPlayer class in 4.0.0 instead of the class TrackPlayer.
You will have much less problem, because this class is much more simple.

Please, keep this issue open, of course.

My point was that I suspect that fixing this long existing issue may be
difficult in the 3.x build.

I was not suggesting that he adopt it for production hence my reference to
pushing 5.0 into beta.

Users with these sort of problems have a vested interest in trialing betas
which can help us get the code into production faster.

The fixes required for this bug probably can't be made without breaking the
API which then requires a bump in the major release no.

If that is the case we are better off applying the limited resources we
have in getting 5.0 which has a fix for this issue

On Mon, 27 Apr 2020, 6:25 pm Larpoux, notifications@github.com wrote:

I completely disagree with @bsbutton :
Maintenance and development are two different things.
It is totally irresponsible to suggest to use a dev version to a user
having bugs in a released version.

Maintenance is done using patches, not new development.
This is the only way to have a product being more and more stable and bug
free.
Of course, an eventual new V5.0.0 will have (at least) 10 times more bugs
than the current released version. This is definitely not possible for
@Sander876 https://github.com/Sander876 to consider switching to a dev
version because he has bug in the current released version.

โ€”
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/dooboolab/flutter_sound/issues/317#issuecomment-619817994,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAG32OAI7IUDCQ5P45ZX2VTROU6PXANCNFSM4MORTUTA
.

The fixes required for this bug probably can't be made without breaking the API which then requires a bump in the major release no.

NO! Really NO!
This bug needs 3 things :

  • Understand which java variable gives us a "Null Pointer Reference"
  • Understand why this variable is NULL
  • Protect the code so that it will not a crash.

A null pointer reference is a terrible thing. Flutter Sound must not fall into a such thing.
This must be fixed. If we cannot fix that, better to throw an exception than to crash.

I believe the issue is cause by a race condition in the initialisation
sequence.

In which case fixing this npe will just move the problem elsewhere.

On Mon, 27 Apr 2020, 7:54 pm Larpoux, notifications@github.com wrote:

The fixes required for this bug probably can't be made without breaking
the API which then requires a bump in the major release no.

NO! Really NO!
This bug needs 3 things :

  • Understand which java variable gives us a "Null Pointer Reference"
  • Understand why this variable is NULL
  • Protect the code so that it will not a crash.

A null pointer reference is a terrible thing. Flutter Sound must not fall
into a such thing.
This must be fixed. If we cannot fix that, better to throw an exception
than to crash.

โ€”
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/dooboolab/flutter_sound/issues/317#issuecomment-619870481,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAG32OHIYXKWQ5HWT6CMGKDROVI6HANCNFSM4MORTUTA
.

Thanks for the energy and commitment, really appreciate it. @Larpoux just a double check, I'm already using the FlutterSoundPlayer class, as shown in the example code I've posted, which is causing the nullpointer. Do you think it's worth it to change to the TrackPlayer class?

I do understand the argument in using beta code for production, it's not something I want to do. Though not sure what other options I have except for going back to 1.5.2.

@Larpoux just a double check, I'm already using the FlutterSoundPlayer class, as shown in the example code I've posted, which is causing the nullpointer.

This is strange, because your crash occurs in the Java code doing a StartPlayerFormTrack().
If you use FlutterSoundPlayer this function would not be available and you would not be able to compile.

Do you think it's worth it to change to the TrackPlayer class?

Certainly NOT

@Sander876 :
Please double check your code to be sure that you do not instantiate TrackPlayer.
I am Puzzled because you crash in TrackPlayer routines.

Did a double check, full search through all code and found no usage of TrackPlayer. Only widget which uses flutter sound functionality does the below. I've edited it for simplicity, I do keep track of states (recording, playing etc).

  FlutterSoundRecorder flutterSoundRecorder;
  FlutterSoundPlayer flutterSoundPlayer;
  StreamSubscription _recorderSubscription;
  StreamSubscription _dbPeakSubscription;
  StreamSubscription _playerSubscription;
  String path = "";
  @override
  void initState() {
    super.initState();
    flutterSoundRecorder = new FlutterSoundRecorder();
    flutterSoundPlayer = new FlutterSoundPlayer();
    ...
  }
  @override
  void dispose() {
    if(flutterSoundRecorder != null) {
      flutterSoundRecorder.release();
    }
    if(flutterSoundPlayer != null) {
      flutterSoundPlayer.release();
    }
    super.dispose();
  }

```
void startRecorder() async {
try {

  await flutterSoundRecorder.initialize();
  await flutterSoundRecorder.setDbLevelEnabled(true);
  await flutterSoundRecorder.setSubscriptionDuration(0.01);
  await flutterSoundRecorder.setDbPeakLevelUpdate(0.5);

  await flutterSoundPlayer.initialize();

  String path_start = ""; //custom save location
  path = await flutterSoundRecorder.startRecorder(uri: path_start, codec: t_CODEC.CODEC_AAC);

  _recorderSubscription = flutterSoundRecorder.onRecorderStateChanged.listen((e) {
    //update timer
  });
  _dbPeakSubscription = flutterSoundRecorder.onRecorderDbPeakChanged.listen((value) {
        //update db level
      });

} catch (err) {
  //logging
}

}


void stopRecorder() async {
try {
String result = await flutterSoundRecorder.stopRecorder();

  if (_recorderSubscription != null) {
    _recorderSubscription.cancel();
    _recorderSubscription = null;
  }
  if (_dbPeakSubscription != null) {
    _dbPeakSubscription.cancel();
    _dbPeakSubscription = null;
  }

} catch (err) {
  //logging
}

}


void startPlayer() async {

await flutterSoundPlayer.initialize();

String path = await flutterSoundPlayer.startPlayer(this.path);
await flutterSoundPlayer.setVolume(1.0);

try {
  _playerSubscription = flutterSoundPlayer.onPlayerStateChanged.listen((e) {
    if (e != null) {
      if(e.currentPosition >= e.duration) {
        return this.stopPlayer();
      }
    }
  });
} catch (err) {
  //logging
}

}


void stopPlayer() async {
try {

  String result = await flutterSoundPlayer.stopPlayer();
  if (_playerSubscription != null) {
    _playerSubscription.cancel();
    _playerSubscription = null;
  }

} catch (err) {
  //logging
}

}
```

Maybe I'm making a mistake somewhere. This is the code which I use in combination with 4.0.1+1 which throws a lot of the mentioned nullpointer exceptions for Android 9 and 10 in Dev Console.

Thanks for the help.

Do you instantiate Flauto.
Flauto is obsolete and better not to use it.
Flauto instantiate TrackPlayer and that could be the problem.

@Larpoux I was thinking the same thing when I searched through flutter_sound code for TrackPlayer. I do include Flauto in the widget I use but it is only used for 't_CODEC.CODEC_AAC'

The includes I use:
import 'package:flutter_sound/flutter_sound_player.dart';
import 'package:flutter_sound/flutter_sound_recorder.dart';
import 'package:flutter_sound/flauto.dart';

OK. This could be the BUG. ๐Ÿ‘
Do you instantiate Flauto ?
(this is not necessary if you just want t_CODEC)

'Unfortunately' not, I only include it as an import and use t_CODEC.CODEC_AAC. Double checked and did a full search for flauto, only found the import and that's all.

OH! I see, now.
We instantiate ourself Flauto. This is very bad code ๐Ÿ‘Ž
I will fix that in the future version 4.0.2

In the mean time, you could remove your imports to Flauto, and try a copy and past of t_CODEC somewhere in your code.

I will fix that this afternoon. So you can wait 4.0.2 without changing your current code.

@Larpoux Great to hear!
However, when I look into Flauto I only find that FlutterSoundHelper will be instantiated. The deprecated class Flauto below it isn't instantiated as far as I can see and I can't find a reference to TrackPlayer from anywhere else. So I'm not sure it's happening because of this.

Yes, you are right :-(

@Sander876 : I built a special Flutter Sound version to trap the guy who does a TrackPlayer.initialize().

Could you try flutter_sound: 4.0.0-debug.1 (probably not good to use it in production. Just for test)

f that is the case we are better off applying the limited resources we have in getting 5.0 which has a fix for this issue

No @bsutton . You are completely wrong. Totally.
If we do not have enough resource to do dev + maintenance, better to abandon the dev.
A product which is not maintained is a dead product. And if the product is dead, you can forget your devs too.

Both Salvatore and you are only interested by dev. And when there is a problem in your code, Salvatore's answer is "I will Push a complete new Flauto code". And your answer is : "Maybe, perhaps, eventually my dev code will fix this issue. But patch ? Never !

I consider myself as the person who is responsible of the maintenance. This is not really what I could call that a Funny Job". But this job has to be done by someone. If not, Flutter Sound will die soon.
I just regret that I do not receive much help by you, the others developers.

@Larpoux I tried the 4.0.0-debug.1 on a couple of devices and the "TrackPlayer is supposed to be instinciated here." exception is never reached. So I think the exception doesn't have anything to do with TrackPlayer.
After digging a bit more, I think this might be causing the issue (android manifest):

        <service android:name=".BackgroundAudioService" >
            <intent-filter>
                <action android:name="android.intent.action.MEDIA_BUTTON" />
                <action android:name="android.media.AUDIO_BECOMING_NOISY" />
                <action android:name="android.media.browse.MediaBrowserService" />
            </intent-filter>
        </service>

It could cause the service to be started based on the mentioned actions, even if BackgroundAudioService is not used. Pretty sure that is causing the crash.
Not sure if the intent-filter is needed at all for the functionality of the package. Would be great if a version would be created that removed that code from the manifest.

Curious what you think of it. Thanks!

I think you do not have the bug, because in my debug version, when someone try to instantiate or initialize a trackPlayer, I throw immediately an exception.
An exception is better than a NULL pointer reference in java, because it can be handled by upper routines instead of crash.
But this does not explain your bug. Probably you will have some "Exceptions traps" if you look to your logs. Is it possible to have access to your logs ?

he "TrackPlayer is supposed to be instinciated here." exception is never reached.

Strange. I am completely sur that your crash are in the TrackPlayer initialization.
So you should have an exception now, when trying.
I do not understand.

       <intent-filter>
            <action android:name="android.intent.action.MEDIA_BUTTON" />
            <action android:name="android.media.AUDIO_BECOMING_NOISY" />
            <action android:name="android.media.browse.MediaBrowserService" />
        </intent-filter>

Those lines in the manifest are just for users using TrackPlayer.
You do not need them, and you can try without them.
If this is the reason of your crash, we will have to find how to be compatible with TrackPlayer.
But actually, we must just try to master the reason of your crashes.

TrackPlayer is tough code. Difficult to maintain.
But this feature is really great for many developers, and there is no possibility to abandon it.
Too many developers want it.
We will really continue to support this function and debug it.

@Larpoux I'm 90% sure that manifest code is causing it. If I look at the logs I'm getting in Dev Console it states a createService error and the following part:

Caused by: java.lang.NullPointerException:
at com.dooboolab.fluttersound.BackgroundAudioService.b (BackgroundAudioService.java:68)
at com.dooboolab.fluttersound.BackgroundAudioService.onCreate (BackgroundAudioService.java:6)

The background service is started automatically by android by one of the Intent filter actions (media button, audio_becoming_noisy or mediabrowserservice). Android will automatically start the background service if one of the actions is triggered, even if I don't use any code related to the background service.

Looking at my mapping file (I use obfuscation) it seems that the nullpointer is happening in onCreate and in the initMediaSession() function. I can't pin point it any further since it's not easy debugging with only production errors.

I'll probably pull 4.0.1+1 and edit the manifest to remove the intent filter and push to production again today/tomorrow. I can let you know in about 1 or 2 days if it fixed the exception. Thanks for the help!

You are great ๐Ÿฅ‡ ๐Ÿ‘ !!!
If you confirm that this is your bug, this is wonderful news.
I will find a way to fix that if this is the reason of your crashes.

Thank you for your help. You definitely helped us.

When you have crash, you get the following lines :

at com.dooboolab.fluttersound.BackgroundAudioService.b (BackgroundAudioService.java:68)
at com.dooboolab.fluttersound.BackgroundAudioService.onCreate (BackgroundAudioService.java:6)

com.dooboolab.fluttersound.BackgroundAudioService is a Flutter Sound Java module which is used for TrackPlayer.
I have difficulty to understand why you have this crash if nobody use TrackPlayer.
I am a little bit stubborn.

@Larpoux Indeed it is the Android java module. Since the BackgroundAudioService is also specified with the before mentioned intent filter (inside the Android manifest) it will cause Android to 'run' the BackgroundAudioService when one of the actions is met.

So for example:
Someone presses a button on their headset->the action is android.intent.action.MEDIA_BUTTON->Android will send the action to every java class which is specified in a app manifest and has the android.intent.action.MEDIA_BUTTON filter->since it corresponds to the flutter sound BackgroundAudioService java class Android itself will run the BackgroundAudioService.

I hope I'm able to explain it a bit. However, fingers crossed, the thing with bugs is sometimes it's something completely different than expected.. I'll keep you updated!

OHHH !!!!! yes !!!!
I did not look to the Manifest carefully.
I did not see that there is a reference to our F*ing class.
I have no doubt, now that you find the bug.
This is 99% sure, now.

Thank you again for your help.

Just for your information :

We already had problems in this class because the global variable androidActivity was null.
I really did not understood how it was possible, because I was sure that TrackPlayer was initialized.
So I added an assert in initMediaSession :

    assert(Flauto.androidActivity != null);
    Context       context       = getApplicationContext();
    Intent        intent        = new Intent( context, Flauto.androidActivity.getClass() );

The problem you encountered during your App in production, is that assert code is not generated.

Actually, I think that the NULL pointer reference is androidActivity.
I will fix that, now that I understand that create() can be called without initializing TrackPlayer.

I'm having my fingers crossed that the manifest is indeed the bug. I was just able to push the edited version to production and should be able to get some feedback in a few days on whether the bug still shows up. Thanks for the help!

Hi Sander,

I have just released Flutter Sound 4.0.2+2.
This version is supposed to fix the access to the global variable androidActivity which was null and crashes in the routine onCreate()

@Sander876 ,

Please re-open this issue if not fixed in 4.0.2+2

@Larpoux Just wanted to let you know that since I removed the intent filters for the Android manifest the crash didn't happen anymore. I won't be able to check out the new fix you published yet, since I'v released so many new versions in a short time to fix the crash I'll let some time pass before the next update.
Maybe there is another option to not have the intent filters? Might be a bit weird the service is started even if some users off your library never want to use the service.
Thanks again for the help!

Maybe there is another option to not have the intent filters? Might be a bit weird the service is started even if some users off your library never want to use the service.

Yes! this is very dirty. Unfortunately I do not master this concept of "intent", and I do not know how to get rid of those f*ing lines in the Manifest.

Good point, you do seem to use the intent filters in your code. It would seem there are a couple of different usages for flutter_sound with different requirements. I gave it some thought but can't come up with a solution immediately. Best for now would be to check indeed inside the service if it was started on purpose and if not exit the service immediately.

Must clean the Android Manifest when the App does not need TrackPlayer

Couldn't we make the code smarter so the code triggered by the manifest
does minimal work until a track is played?

Requiring the user to edit the manifest feels ugly.

On Sat, 2 May 2020, 7:03 pm Larpoux, notifications@github.com wrote:

Must clean the Android Manifest when the App does not need TrackPlayer

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dooboolab/flutter_sound/issues/317#issuecomment-622911581,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAG32OFRYMRTJUZKAFYYJULRPPOUHANCNFSM4MORTUTA
.

Same Issue with me in version ^4.0.3+1 or Should i file another bug report ?

8

Production Google Play crash reports i have more than 79 people impacted with this error

5

It started from 20-4-2020 when i added flutter sound plugin and uploaded an update to google paly

6

Almost all the devices are huawei with android 8 and 8.1

7

This is my flutter doctor output

[โˆš] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18362.476], locale en-US)
    โ€ข Flutter version 1.12.13+hotfix.9 at C:\Android\flutter
    โ€ข Framework revision f139b11009 (5 weeks ago), 2020-03-30 13:57:30 -0700
    โ€ข Engine revision af51afceb8
    โ€ข Dart version 2.7.2

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    โ€ข Android SDK at C:\Android\sdk\sdk
    โ€ข Android NDK location not configured (optional; useful for native profiling support)
    โ€ข Platform android-29, build-tools 29.0.2
    โ€ข ANDROID_HOME = C:\Android\sdk\sdk\platform-tools
    โ€ข Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    โ€ข Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[โˆš] Android Studio (version 3.6)
    โ€ข Android Studio at C:\Program Files\Android\Android Studio
    โ€ข Flutter plugin version 45.1.1
    โ€ข Dart plugin version 192.7761
    โ€ข Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[!] IntelliJ IDEA Community Edition (version 2019.2)
    โ€ข IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2.1
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    โ€ข For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[โˆš] VS Code (version 1.37.1)
    โ€ข VS Code at C:\Users\Amr Abd Alkrim\AppData\Local\Programs\Microsoft VS Code
    โ€ข Flutter extension version 2.25.1

[โˆš] Connected device (1 available)
    โ€ข G8 โ€ข 1090308019017967 โ€ข android-arm64 โ€ข Android 9 (API 28)

! Doctor found issues in 2 categories.

I don't have a "Huawei Y7 Prime 2019 (HWDUB-Q), 3072MB RAM, Android 8.1" to test flutter run and give you the output. Is this information enough to know the bug ?

@3mrdev :
We are sorry that you encounter crashes with flutter_sound. ๐Ÿ‘Ž
Your Problem Report is perfect.
I am going to look to that and see what can be done.

For what is worth, I believe you can reproduce this issue by restarting your device. App crashes after system reboots by itself (no need to open the app)

Do you have to do anything before the reboot.

E.g. play audio.

Trackplayer or sound player?

On Wed, 6 May 2020, 7:00 pm SzymonJarosz, notifications@github.com wrote:

For what is worth, I believe you can reproduce this issue by restarting
your device. App crashes after system reboots by itself (no need to open
the app)

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dooboolab/flutter_sound/issues/317#issuecomment-624526950,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAG32OG32263PRGD76VCIQLRQERLZANCNFSM4MORTUTA
.

So here is a clue:

The Flutao.java class supports v2 flutter embedding and v1.

The registerWith method is only called on older android version.
This means that on older systems androidActivity is initialised but on newer systems it will never be initialised.

I'm still reading but the Intent registration in BackgroundAudioService looks wrong (more than just the fact that androidActivity is only available on v1 systems).

I removed the access to androidActivity in V4.0.3.
This access was not necessary and absent in @salvatore373 code.

Actually, BackgroundAudioService does not import any more flauto
This was a mistake from me.

My problem is that I do not master at all this concept of services and intent-filter.
I should read the Google doc, but it will not be easy for me.

OK, that does make more sense.

Do we have a stack trace that matches the code changes you made?

On Wed, 6 May 2020 at 21:50, Larpoux notifications@github.com wrote:

Actually, BackgroundAudioService does not import any more flauto

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dooboolab/flutter_sound/issues/317#issuecomment-624603725,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAG32OAOWVB3I4MUIG2MEFTRQFFJHANCNFSM4MORTUTA
.

I'm having a read now.

Do you want to start a zoom to see if we can work the problem through?

Zoom is hard for me, because of my very bad english

If you have removed the flutao code from the background service then what
bit of the code is crashing?

On Wed, 6 May 2020 at 21:53, Larpoux notifications@github.com wrote:

My problem is that I do not master at all this concept of services and
intent-filter.
I should read the Google doc, but it will not be easy for me.

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dooboolab/flutter_sound/issues/317#issuecomment-624604758,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAG32OGVB7P27AL3R3WRSQDRQFFSZANCNFSM4MORTUTA
.

Do we have a stack trace that matches the code changes you made?

The stack that @3mrdev posted seems to correspond to something before my fix.

I still really hope that my fix is OK. But hard for @3mrdev to check that because the problem occurs in production ๐Ÿ‘Ž

what about a chat system?

On Wed, 6 May 2020 at 21:55, Larpoux notifications@github.com wrote:

Zoom is hard for me, because of my very bad english

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dooboolab/flutter_sound/issues/317#issuecomment-624605599,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAG32OE45NEHYOVSUXEOOWLRQFF2JANCNFSM4MORTUTA
.

OK for zoom:)

what is you zoom address again?

I've sent you an invite.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edward-yakop picture edward-yakop  ยท  4Comments

felixjunghans picture felixjunghans  ยท  4Comments

BeshoyMelika picture BeshoyMelika  ยท  3Comments

PabloduPontavice picture PabloduPontavice  ยท  3Comments

alby97 picture alby97  ยท  5Comments