DMAudioStreamer icon indicating copy to clipboard operation
DMAudioStreamer copied to clipboard

Notification causes crash after 8.1 updates

Open MilanVucic opened this issue 6 years ago • 16 comments

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.

MilanVucic avatar Aug 23 '18 10:08 MilanVucic

Thanks :) MilanVucic, sure will update notification builder

dibakarece avatar Aug 26 '18 06:08 dibakarece

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

Cheers, thanks.

MilanVucic avatar Aug 26 '18 15:08 MilanVucic

@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.

MilanVucic avatar Sep 06 '18 12:09 MilanVucic

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

archie94 avatar Dec 26 '18 05:12 archie94

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'

dibakarece avatar Dec 26 '18 18:12 dibakarece

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

MilanVucic avatar Jan 14 '19 16:01 MilanVucic

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

dibakarece avatar Jan 15 '19 03:01 dibakarece

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

archie94 avatar Jan 15 '19 07:01 archie94

@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 avatar Jan 16 '19 11:01 MilanVucic

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.

MilanVucic avatar Jan 16 '19 11:01 MilanVucic

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.

archie94 avatar Jan 16 '19 12:01 archie94

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.

MilanVucic avatar Jan 17 '19 14:01 MilanVucic

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.

archie94 avatar Jan 21 '19 09:01 archie94

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

dibakarece avatar Jan 22 '19 05:01 dibakarece

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

MilanVucic avatar Jan 23 '19 10:01 MilanVucic

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

enyholar avatar Aug 12 '19 23:08 enyholar