Nasdomlan Urban3p
Nasdomlan Urban3p

Reputation: 49

Builder (Context) in Builder cannot be applied to (Context, java.lang.String)

I have this error

Builder(Context)in Builder cannot be applied to (Context, java.lang.String)

On this line

`final NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mContext, CHANNEL_ID);`

My build.gradle

compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
    applicationId "com.whrsmxmx.vk_api_test"
    minSdkVersion 22
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

How i can correct this code? If I clear the channel, then notifications come, there is a sound, but there is no pop-up window in the status bar.

Upvotes: 2

Views: 1045

Answers (1)

Llane00
Llane00

Reputation: 86

It related to the version of "com.android.support:appcompat".

Just change the config to compile 'com.android.support:appcompat-v7:27.+' in the file build.gradle

And you may also need to add some configs. like:

    repositories {
         jcenter()
         mavenCentral()
         maven{url "https://maven.google.com"}
    }

Upvotes: 1

Related Questions