Hi.
Describe the bug
A exception is thrown every time an just_audio player is constructed:
Error messages
MissingPluginException(No implementation found for method init on channel com.ryanheise.just_audio.methods)
This is my BackgroudAudioTask
class RadioAudioTask extends BackgroundAudioTask {
final String url;
RadioAudioTask({@required this.url});
AudioPlayer audioPlayer = AudioPlayer(); // MissingPluginException here.
Completer _completer = Completer();
@override
Future<void> onStart() async {
print('Start');
// _player.setUrl(url);
await _completer.future;
}
@override
void onStop() {
print('Stop');
// _player.stop();
_completer.complete();
}
@override
void onPlay() {
print('Play');
// _player.play();
}
}
Runtime Environment
I'm trying with 0.1.0 and 0.0.6 of just_audio.
Flutter SDK version
Doctor summary (to see all details, run flutter doctor -v):
[鉁揮 Flutter (Channel stable, v1.12.13+hotfix.5, on Linux, locale en_US.UTF-8)
[鉁揮 Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[鉁揮 Android Studio (version 3.4)
[鉁揮 VS Code (version 1.41.1)
[鉁揮 Connected device (1 available)
Can you please fork this project and make "minimal" changes to it to reproduce the bug? By minimal, I mean the minimal number of dependencies and code.
Sure! Thanks for the response.
Btw, I'm using firebase_messaging, so I think It might be related to #129 but I'm not sure because is an issue with just_audio specifically.
Actually, the output when the conflict between firebase_messaging and audio_service occurs is diferent:
Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'void com.ryanheise.audioservice.AudioServicePlugin$BackgroundHandler.init(io.flutter.plugin.common.BinaryMessenger)' on a null object reference, null)
Hi.
I had the same problem but solved it by changing the app's MainActivity.java and AndroidManifest.xml following the steps below.
https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
Hi @Pregum, thank you! That was the problem.
Glad to hear you got it working.