Unable to integrate FCM in ionic 5

ERROR:
FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • Where:
    Script ‘D:\IonicFirebaseDemo\platforms\android\cordova-plugin-fcm-with-dependecy-updated\ionicfirebase-FCMPlugin.gradle’ line: 22

  • What went wrong:
    A problem occurred evaluating script.

Cannot invoke method lastIndexOf() on null object

  • 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 ‘:app’.

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

BUILD FAILED in 2s
Command failed with exit code 1: D:\IonicFirebaseDemo\platforms\android\gradlew cdvBuildDebug -b
D:\IonicFirebaseDemo\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.

    cordova.cmd build android exited with exit code 1.

    Re-running this command with the --verbose flag may provide more information.

IONIC INFO
D:>ionic info

Ionic:

Ionic CLI : 6.16.3 (C:\Users\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 5.6.11
@angular-devkit/build-angular : 12.0.5
@angular-devkit/schematics : 12.0.5
@angular/cli : 12.0.5
@ionic/angular-toolkit : 4.0.0

Cordova:

Cordova CLI : 10.0.0
Cordova Platforms : not available
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 5 other plugins)

Utility:

cordova-res : 0.15.3
native-run : 1.4.0

System:

Android SDK Tools : 26.1.1 (C:\Users\AppData\Local\Android\Sdk)
NodeJS : v14.17.1 (C:\Program Files\nodejs\node.exe)
npm : 6.14.13
OS : Windows 10

1 Like

Did you find solution for your first Error ?

This post was flagged by the community and is temporarily hidden.