Android compile error after upgrade - No signature of method

Recently taken an app using Ionic 3 built with Cordova and migrated over to Ionic 6 as well as changed to Capacitor.

Migration all done now and I have been able to build for iOS but am having an issue with Android.

When opening in Android Studio, I am getting the following error:

Caused by: groovy.lang.MissingMethodException: No signature of method: is applicable for argument types: (build_66ciegw2jwczi5uqnnem0k4ze$_run_closure2) values: [build_66ciegw2jwczi5uqnnem0k4ze$_run_closure2@7701ebf4]

I have searched around and tried several things such as ensuring variables.gradle have quotes around everything except versions, this looks like this:

ext {
    minSdkVersion = 22
    compileSdkVersion = 30
    targetSdkVersion = 30
    androidxActivityVersion = '1.4.0'
    androidxAppCompatVersion = '1.4.2'
    androidxCoordinatorLayoutVersion = '1.2.0'
    androidxCoreVersion = '1.8.0'
    androidxFragmentVersion = '1.4.1'
    coreSplashScreenVersion = '1.0.0-rc01'
    androidxWebkitVersion = '1.4.0'
    junitVersion = '4.13.2'
    androidxJunitVersion = '1.1.3'
    androidxEspressoCoreVersion = '3.4.0'
    cordovaAndroidVersion = '10.1.1'

There was a suggestion to use ./gradlew clean which seems to have given more information about the issue:

FAILURE: Build failed with an exception.

* Where:

Script '..../node_modules/cordova-plugin-firebasex/src/android/build.gradle' line: 21

* What went wrong:

A problem occurred evaluating script.

> No signature of method: is applicable for argument types: (build_66ciegw2jwczi5uqnnem0k4ze$_run_closure2) values: [build_66ciegw2jwczi5uqnnem0k4ze$_run_closure2@66b9298d]

* 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 ****

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.


**BUILD FAILED** in 460ms

This would seem to suggest an issue with Firebasex but I am unable to find any further details on this.

My Ionic info looks like this:

I am using Android Gradle plugin version 4.2.0 and Gradle version 7.4.2 with version 11 of the JDK.

Any pointers will be greatly appreciated, thank you in advance.

You have to use gradle plugin 7.x

Thanks - though getting a compile error on Gradle plugin 7.x too - also using the versions specified on Updating to 3.0 | Capacitor Documentation which states:

We now recommend using Gradle 7.0 with Capacitor projects. In Android Studio, open the File menu, then click Project Structure. In the Project section, change Gradle Version to 7.0and Android Gradle Plugin Version to 4.2.0. Then, click OK.

That’s for Capacitor 3, but looks like you are mixing it with Capacitor 4 plugins or packages and that’s causing the problems.

Ahh ok - I didn’t realise that - pretty new to Capacitor to be honest. Thank you for clarifying.

Using Gradle plugin 7.2.2 I get the following error:

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

Is this something you have come across at all?

Thanks again, you’ve been super helpful

You have a plugin that has a dependency to me.leolin:ShortcutBadger and it’s declaring it as compile 'me.leolin:ShortcutBadger:1.1.19', but compile keywords has been removed on gradle 7 (had been deprecated for years), should use implementation 'me.leolin:ShortcutBadger:1.1.19'.

ShortcutBadger is for showing a notification icon on Android, so search on push/local notification plugins

Thank you so much - that’s really helped though I have come across another stumbling block now with the following error:

Task :capacitor-cordova-android-plugins:processDebugManifest FAILED
/Users/james/coffee-monster/android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml:10:1-14:12 Error:
android:exported needs to be explicitly specified for element <receiver#nl.xservices.plugins.ShareChooserPendingIntent>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See Desenvolvedores Android  |  Android Developers for details.

See for more information about the manifest merger.

Execution failed for task ‘:capacitor-cordova-android-plugins:processDebugManifest’.
A failure occurred while executing$ProcessLibWorkAction

Manifest merger failed with multiple errors, see logs

Working through this one now - will get there eventually I hope! :slight_smile:

that’s the cordova social share plugin not being updated for SDK 32, it has several unmerged pull requests fixing the issue