Android build error: Could not find method compile() for arguments


I am migrating an old ionic angular codebase. I have gotten to a point where my iOS App builds and runs fine but when I try to build the Android version in Android Studio I was getting errors. I have worked through the initial ones but now I get the error below that i am not quite sure how to resolve. I understand compile is deprecated and has to be replaced with implementation but not sure where to address this. I looked into the plugin and searched but don’t see the compile statement anywhere.

Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method compile() for arguments [me.leolin:ShortcutBadger:1.1.22@aar] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

I traced the me.leolin:ShortcutBadger:1.1.22 to my use of the plugin @awesome-cordova-plugins/badge but don’t see the compile statement that I understand needs to be changed to “Implementation”

My ionic info output is below


Ionic CLI : 7.1.1 (/Users/username/.nvm/versions/node/v20.2.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.6.1
@angular-devkit/build-angular : 12.2.18
@angular-devkit/schematics : 12.2.18
@angular/cli : 12.2.18
@ionic/angular-toolkit : 5.0.3


Capacitor CLI : 3.9.0
@capacitor/android : 3.9.0
@capacitor/core : 3.9.0
@capacitor/ios : 3.9.0


Cordova CLI : 12.0.0 (cordova-lib@12.0.1)
Cordova Platforms : android 9.1.0, browser 6.0.0, ios 6.2.0
Cordova Plugins : cordova-plugin-ionic-webview 4.2.1, (and 5 other plugins)


cordova-res : 0.15.4
native-run (update available: 1.7.3) : 1.7.1


ios-sim : 8.0.2
NodeJS : v20.2.0 (/Users/username/.nvm/versions/node/v20.2.0/bin/node)
npm : 9.6.6
OS : macOS Unknown
Xcode : Xcode 15.0 Build version 15A240d

Android Studio is Giraffe 2022.3.1 Build #AI-223.8836.35.2231.10406996, built on June 28, 2023

Not quite sure how to address/fix this issue. Appreciate any help/pointers.


For anyone else running into this problem, this article helped me solve the issue

1 Like