Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio Cannot resolve symbol 'NotificationChannel'

I have updated Android Studio to 3.0 Beta 5

Other classes like NotificationManager are imported just fine. But it's not finding NotificationChannel anywhere.

import android.app.NotificationChannel;

What could cause this?

like image 542
eikai Avatar asked Sep 11 '17 12:09

eikai


People also ask

What is Cannot resolve symbol in Android Studio?

Most often “R cannot be resolved” error appears if there is an issue with some of your resource files. Due to this error, you are unable to build your application. That's why we need to solve this error as it not getting away by just doing a simple restart or hitting Alt+Enter.

What is NotificationChannel?

What Are Notification Channels on Android? “Notification Channels” were introduced in 2017 with Android 8.0 Oreo. The idea is that apps can group different types of notifications into “channels.” Each channel can then be turned on or off by the user. This all happens in the Android settings.

What is the channel ID in Android notification?

ChannelId is a unique String to identify each NotificationChannel and is used in Notification. Builder (line 7) when constructing the Notification object. NotificationChannel settings, except channel name and description text, are immutable after it is submitted to NotificationManager at line 5.

How do I get notifications for my channel?

To turn on the setting for a development device running Android 8.0 (API level 26), navigate to Settings > Developer options and enable Show notification channel warnings.


2 Answers

NotificationChannel is added in API 26 change your compile SDK to 26 and try

Reference: https://developer.android.com/reference/android/app/NotificationChannel.html

like image 133
Raghavendra Avatar answered Sep 18 '22 17:09

Raghavendra


set compileSdkVersion 26 in build.gradle

like image 38
Sky Avatar answered Sep 20 '22 17:09

Sky