React-native-notifications: Android Compile Error

Created on 24 Jul 2020  路  29Comments  路  Source: wix/react-native-notifications

I met android compile error.
react-native: 0.63.2
react-native-notifications: 3.3.0

Log is like this. react-native-notifications: 3.2.2 works good.

1: Task failed with an exception.

  • Where:
    Build file '/node_modules/react-native-notifications/lib/android/app/build.gradle' line: 4

  • What went wrong:
    A problem occurred evaluating project ':react-native-notifications'.

    Plugin with id 'kotlin-android' not found.

  • Try:

    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

2: Task failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':react-native-notifications'.

    compileSdkVersion is not specified. Please add it to build.gradle

  • Try:

    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Most helpful comment

Based on a suggestion for another library producing a similar error, I have applied the following changes. They seem to work. The following code demonstrates ONLY the changes. I am NOT suggesting deleting the rest of the code in the file.
File: android/build.gradle

buildscript {
    ext {
        minSdkVersion = 21 // change this one from 16 to 21 
        kotlinVersion = "1.3.72" // add this line 
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" // add this line 
    }
}

All 29 comments

Based on a suggestion for another library producing a similar error, I have applied the following changes. They seem to work. The following code demonstrates ONLY the changes. I am NOT suggesting deleting the rest of the code in the file.
File: android/build.gradle

buildscript {
    ext {
        minSdkVersion = 21 // change this one from 16 to 21 
        kotlinVersion = "1.3.72" // add this line 
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" // add this line 
    }
}

It do not work.
The problem: Received close_notify during handshake

Same issue for me... RN 0.63.2, react-native-notifications 3.3.2

Same issue for me.

RN 0.63.2
react-native-notifications 3.3.2

Same issue for me

RN 0.63.2
React native notifications 3.3.2

Based on a suggestion for another library producing a similar error, I have applied the following changes. They seem to work. The following code demonstrates ONLY the changes. I am NOT suggesting deleting the rest of the code in the file.
File: android/build.gradle

buildscript {
  ext {
      minSdkVersion = 21 // change this one from 16 to 21 
      kotlinVersion = "1.3.72" // add this line 
  }

  dependencies {
      classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" // add this line 
  }
}

Dropping Android 4 support is no solution for us.

Why was this changed in a recent release? Does the library require this now? The docs do not include any information and there are no changelogs.

Same issue for me

RN 0.63.2
React native notifications 3.3.2

Same for me.
RN 0.62.2
React native notifications 3.3.2

Same for me.
RN 0.62.2
React native notifications 3.3.2

Same for me.
RN 0.63.2
React native notifications 3.3.2

Same for me.
RN 0.63.2
React native notifications 3.3.2

Same for me
RN 0.63.2
React native notifications 3.3.2

Issue:

ERROR: Plugin with id 'kotlin-android' not found.

+1

The solution proposed by @Bilal-Abdeen works but the app crash on startup. It now compile properly though.

@clamiax Try the following

  1. cd /android
  2. gradlew clean
  3. cd ..
  4. npx react-native run-android

@Bilal-Abdeen I already tried but with no luck. The app keep crashing on startup.

EDIT: I currently "solved" with react-native-push-notification.

+1

Same for me.
RN 0.63.2
React native notifications 3.3.2

The same issue +1.

RN 0.63.2
React native notifications 3.3.2

Same for me

in my case:
"react-native": "0.61.5",
"react-native-notifications": "^3.3.4",
it is working for me fine so far.

buildscript { ext { buildToolsVersion = "29.0.3" minSdkVersion = 24 compileSdkVersion = 29 targetSdkVersion = 29 appCompatVersion = "1.0.2" googlePlayServicesVersion = "+" kotlinVersion = "1.3.72" } repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.4.2' classpath 'com.google.gms:google-services:4.3.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" } }

@Bilal-Abdeen

Your solutions works in my application.

version

"react-native": "0.63.2"
"react-native-notifications": "^3.3.4"

android/build.gradle

buildscript {
    ext {
        // googlePlayServicesVersion = "+"
        // firebaseMessageVersion = "+"
        buildToolsVersion = "29.0.2"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 29
        kotlinVersion = "1.3.72"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.5.3")
        classpath("com.google.gms:google-services:4.3.3")
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

"react-native-push-notification": "^5.1.1"

you are using a different library ;-) ?

@danielwinkler ops, my bad. But the solutions works.

I am using the same config as HackerTon (after he edited), after adding kotlin to the classpath everything works fine 馃暫

@Bilal-Abdeen

Your solutions works in my application.

version

"react-native": "0.63.2"
"react-native-notifications": "^3.3.4"

android/build.gradle

buildscript {
    ext {
        // googlePlayServicesVersion = "+"
        // firebaseMessageVersion = "+"
        buildToolsVersion = "29.0.2"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 29
        kotlinVersion = "1.3.72"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.5.3")
        classpath("com.google.gms:google-services:4.3.3")
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

The solutions works. Thank you

Based on a suggestion for another library producing a similar error, I have applied the following changes. They seem to work. The following code demonstrates ONLY the changes. I am NOT suggesting deleting the rest of the code in the file.
File: android/build.gradle

buildscript {
  ext {
      minSdkVersion = 21 // change this one from 16 to 21 
      kotlinVersion = "1.3.72" // add this line 
  }

  dependencies {
      classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" // add this line 
  }
}

@Bilal-Abdeen
I don't get it, Why we should drop support for android versions 14-20 just because of react-native-notification? 馃槙

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Please keep this open. Not resolved yet.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

veedeo picture veedeo  路  6Comments

TheMisir picture TheMisir  路  4Comments

WhereBeTheDan picture WhereBeTheDan  路  5Comments

moonjava2005 picture moonjava2005  路  5Comments

Bilal-Abdeen picture Bilal-Abdeen  路  4Comments