Skip to content

Getting error when build app using Cordova #155

@aravindforums1

Description

@aravindforums1

Hi, i am try to add badge count for android app using cordova-plugin-badge, for that i used ShortcutBadger too.
i install cordova-plugin-badge ver 0.8.8 , after i add below code in build.gradle and try to build

repositories {
mavenCentral()
}

 if (!project.ext.has('appShortcutBadgerVersion')) {
 ext.appShortcutBadgerVersion = '1.1.22'
 }

 if (!project.ext.has('appShortcutBadgerCustom')) {
 dependencies {
 //compile "me.leolin:ShortcutBadger:${appShortcutBadgerVersion}@aar"
 implementation "me.leolin:ShortcutBadger:${appShortcutBadgerVersion}@aar"
 }
 }

First i get error for Could not find method compile() for arguments , then i replace compile to implementation still getting error.

Below is the error when build

  • What went wrong:
    A problem occurred evaluating root project 'badge'.

Could not find method implementation() for arguments [me.leolin:ShortcutBadger:1.1.22@aar] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Note: Before add ShortcutBadger , i can build and install apk file in android phone, that time i added below code in index.js

   if (cordova.plugins.notification.badge.isActivated) {
     alert('cordova-plugin-badge is active');
     console.log('cordova-plugin-badge is active');
     cordova.plugins.notification.badge.set(10);
     } else {
     alert('cordova-plugin-badge is NOT active');
     console.log('cordova-plugin-badge is NOT active');
     cordova.plugins.notification.badge.set(10);
     }

When i run app in mobile device , i always get 'cordova-plugin-badge is NOT active' , not sure how to activate ?
I want to show badge count number instead of dot in app icon, currently i get dot in app icon, in mobile setting there is no option to change notification as Number.
In whatsapp and sms i can see three options like "Number" , "Dot" and No Badge.
Anything need to add in my project config or gradle ?

Thanks and Regards
Aravind

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions