dibakarece / DMAudioStreamer

DMAudioStreamer library help you to integrate audio streaming in your application.
Apache License 2.0
143 stars 61 forks source link

Notification causes crash after 8.1 updates #20

Open MilanVucic opened 6 years ago

MilanVucic commented 6 years ago

I have been getting this crash when trying to display notification:

android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null pri=0 contentView=com.humancondition.wtm/0x7f0d0044 vibrate=null sound=null defaults=0x0 flags=0x42 color=0x00000000 vis=PRIVATE) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1768) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

The solution to it is given on this SO post. Can you please update your Notification builder as to solve this crash?

All the best.

dibakarece commented 6 years ago

Thanks :) MilanVucic, sure will update notification builder

MilanVucic commented 6 years ago

Amazing, thank you man. Can you ping this thread and close it once it has been implemented?

Cheers, thanks.

MilanVucic commented 6 years ago

@dibakarece When can we expect to have this up? I am using this in an app and I'd really appreciate this feature. Thank you.

archie94 commented 5 years ago

@MilanVucic could you checkout now and see if this is solved?

dibakarece commented 5 years ago

Latest version has been released now. Please test with latest version and let me know if any issue. -> implementation 'com.github.dibakarece:DMAudioStreamer:v1.0.5'

MilanVucic commented 5 years ago

Well when I change to v1.0.5 it doesn't build properly.

I get 3 errors error: failed linking references. . When I open one of the files where the error occurs, I see this like <item name="dialogCornerRadius">?android:attr/dialogCornerRadius</item> in values-v28.

And the error is error: resource android:attr/dialogCornerRadius not found.

I had to use v1.0.4 in order to have the project build. I reverted back and it builds just fine. So something went wrong @archie94 @dibakarece

dibakarece commented 5 years ago

Can you please send me your app build.gradle detail... I just migrate my project to androidx ..probably that is the reason.

archie94 commented 5 years ago

I cant see android:attr/dialogCornerRadius property in this project? Could you please send the entire stack trace?

MilanVucic commented 5 years ago

@dibakarece @archie94 I managed to fix it using this question. I actually just changed the compileSdkVersion to 28. It was 27. It now builds.

BUT there's a new problem:

Program type already present: android.support.v4.media.MediaBrowserCompat$CustomActionCallback Message{kind=ERROR, text=Program type already present: android.support.v4.media.MediaBrowserCompat$CustomActionCallback, sources=[Unknown source file], tool name=Optional.of(D8)}

I googled it, and found this. Apparently it has to do with androidX library. The answer didn't help me though.

MilanVucic commented 5 years ago

I've had "program type already" present errors before. That's the case when 2 dependencies rely on the same thing and try to include it twice, as far as I understood. Can you check what's going on with this?

It is very weird though, it DOES build once I click on "Build" only. But when I try to run, I get this.

archie94 commented 5 years ago

android.support.v4.media.MediaBrowserCompat is in package androidx.media:media:1.0.0 and also in some android.support.v4 which is present in your project I am assuming.

Try using

configurations.all {
        resolutionStrategy {
            force 'androidx.media:media:1.0.0'
        }
    }

and see if this solves your problem.

MilanVucic commented 5 years ago

Nope, still doesn't work. Can we do without AndroidX cause it seems to mess it up? @archie94 Still same error. Program type already present.

archie94 commented 5 years ago

AndroidX is the unavoidable future.

I would suggest you try to migrate your project to AndroidX. https://developer.android.com/jetpack/androidx/migrate

It is true that this AndroidX dependency adds a headache for consumers of this library and if it is too much of inconvenience we may have to do without it for now. Let's see what @dibakarece thinks about this.

dibakarece commented 5 years ago

let me check with andorid 28.0 build gradle lib ... if it's okay difinitly will provide some solution for you :)

MilanVucic commented 5 years ago

Thanks man, I appreciate it very much. Let me know when you think of a solution.

enyholar commented 5 years ago

Notification not showing on Android Pie, what is the solution even when i fork the sample project from the library...notification still not showing on android pie