mergehez / ArgPlayer

An android music player library
Apache License 2.0
70 stars 23 forks source link

Attempt to invoke virtual method 'java.lang.String java.lang.Class.getName()' on a null object reference #7

Closed tolgatasci closed 3 years ago

tolgatasci commented 3 years ago
ArgPlayerLargeView mediaplayer = (ArgPlayerLargeView) findViewById(R.id.argmusicplayer);
ArgAudioList playlist = new ArgAudioList(true);
ArgAudio argAudio = ArgAudio.createFromURL("One Piece", "Binks Sake","http://www.noiseaddicts.com/samples_1w72b820/2563.mp3");
mediaplayer.play(argAudio);
kevinpinhoiamin commented 3 years ago

I got the same error here.

Code Sample:

String url = "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3"; ArgAudio audio = new ArgAudio("Bocelli", "Caruso", url, AudioType.URL); card4Player = root.findViewById(R.id.cardview_expandable_4_content_argmusicplayer); card4Player.play(audio);

Error:

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Class.getName()' on a null object reference at android.content.ComponentName.(ComponentName.java:131) at android.content.Intent.(Intent.java:6091) at com.arges.sepan.argmusicplayer.ArgNotification.(ArgNotification.java:40) at com.arges.sepan.argmusicplayer.ArgMusicService.playAudio(ArgMusicService.java:183) at com.arges.sepan.argmusicplayer.ArgMusicService.playSingleAudio(ArgMusicService.java:226) at com.arges.sepan.argmusicplayer.ArgMusicPlayer.play(ArgMusicPlayer.java:208) at com.arges.sepan.argmusicplayer.ArgPlayerViewRoot.play(ArgPlayerViewRoot.java:211) at com.arges.sepan.argmusicplayer.ArgPlayerView.play(ArgPlayerView.java:10)

de-finnik commented 3 years ago

Got the same error and fixed it with enabling notification via the player: argMusicPlayer.enableNotification(MainActivity.class); However, notifications still don't work.

mergehez commented 3 years ago

I put some more checks into the code and re-pushed the project. I hope it helps..

ZirconZer0 commented 3 years ago

Can confirm it's working as intended without crashing in v2.1. Thank you for your hard work.