0


I'm updating an app, to add Android 8+ support, I was trying to get the app Notifications to work properly (using the now required Channels), but for some reason I can't use the new NotificationCompat.Builder constructor (Context, String). I've already updated my buildToolsVersion (28.0.3 at the moment), as seen here, yet I'm still unable to use the new constructor.

//IDE won't let me use:
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, "channelId");

//While this works fine:
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);

Any ideas on why this could be happening? I already tried to find a solution, but most of them just tell you to update the buildToolsVersion.

Relevant build.gradle code:

android {
    compileSdkVersion 27
    buildToolsVersion '28.0.3'
    defaultConfig {
        ...
        minSdkVersion 16
        targetSdkVersion 27
        ...  
}  
dependencies {
    ...
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    ...
}
urukh
  • 360
  • 1
  • 3
  • 17

1 Answers1

0

I found out what was going on, turns out that the build.gradle file had a configuration script that was overriding all my support dependencies versions to use the v25.3.0. After removing that script the correct lib was imported and the problem was solved.

//This script
...
if (requested.group == 'com.android.support') {
    if (!requested.name.startsWith("multidex")) {
        details.useVersion '25.3.0'
    }
}
urukh
  • 360
  • 1
  • 3
  • 17