No signature of method: build_ct1jx9c5g6evrh3ahd87z7v4n.android() is applicable for argument types: (build_ct1jx9c5g6evrh3ahd87z7v4n$_run_closure1) values: [build_ct1jx9c5g6evrh3ahd87z7v4n$_run_closure1@ade9aaf]
[REQUIRED] Step 2: Describe your environment
- Android Studio version: Android Studio Chipmunk | 2021.2.1 Patch 1
- Firebase Component: firebase-crashlytics, firebase-crashlytics-ndk
- Component version: bom:30.1.0, firebase-crashlytics-gradle:2.9.1
[REQUIRED] Step 3: Describe the problem
My project consists of a Dynamic feature module with native library. We are using firebase crashlytics ndk to upload symbol files for stack traces.
When I am trying to upgrade the firebase-crashlytics-gradle version from 2.7.1 to 2.9.1, gradle sync is failing with below error.
A problem occurred evaluating project ':------'.
> No signature of method: build_ct1jx9c5g6evrh3ahd87z7v4n.android() is applicable for argument types: (build_ct1jx9c5g6evrh3ahd87z7v4n$_run_closure1) values: [build_ct1jx9c5g6evrh3ahd87z7v4n$_run_closure1@ade9aaf]
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':------'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.lambda$apply$0(DefaultScriptPluginFactory.java:133)
Caused by: groovy.lang.MissingMethodException: No signature of method: build_ct1jx9c5g6evrh3ahd87z7v4n.android() is applicable for argument types: (build_ct1jx9c5g6evrh3ahd87z7v4n$_run_closure1) values: [build_ct1jx9c5g6evrh3ahd87z7v4n$_run_closure1@ade9aaf]
at build_ct1jx9c5g6evrh3ahd87z7v4n.run(/Users/ijpl/Siva/mopria_4/MopriaPlugin/DirectOfficeService/build.gradle:8)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)
... 170 more
If I comment out firebaseCrashlytics under buildTypes, I am not facing any gradle sync error, but I may not able to upload symbol file.
buildTypes {
release {
firebaseCrashlytics { // If I comment this block, no gradle sync error
nativeSymbolUploadEnabled true
unstrippedNativeLibsDir "${project.androidNdkOut}"
}
}
debug {
firebaseCrashlytics { // If I comment this block, no gradle sync error
nativeSymbolUploadEnabled false
}
}
}
Steps to reproduce:
- Have one dynamic feature module in project with native library.
- Try upgrading the firebase-crashlytics-gradle version from
2.7.1to2.9.1 - gradle sync error is observed.
Relevant Code:
./build.gradle
buildscript {
...
repositories {
google()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
...
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1'
}
}
./dynamic_module/build.gradle
apply plugin: 'com.android.dynamic-feature'
apply plugin: 'checkstyle'
apply plugin: 'com.google.firebase.crashlytics'
android {
...
buildTypes {
release {
firebaseCrashlytics {
nativeSymbolUploadEnabled true
unstrippedNativeLibsDir "${project.androidNdkOut}"
strippedNativeLibsDir "${project.androidNdkLibsOut}"
}
}
debug {
firebaseCrashlytics {
nativeSymbolUploadEnabled false
}
}
}
...
}
- If I comment out
firebaseCrashlyticsblock, gradle sync is fine. - This issue is observed from
com.google.firebase:firebase-crashlytics-gradle:2.8.1onwards.
I found a few problems with this issue:
- I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
- This issue does not seem to follow the issue template. Make sure you provide all the required information.
Hi @WIPSivaG, thanks for reporting. I tried replicating this issue on a clean project, and I'm unable to reproduce this issue.
Relevant code:
module gradle:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}
android {
buildTypes {
release {
firebaseCrashlytics { // If I comment this block, no gradle sync error
nativeSymbolUploadEnabled true
unstrippedNativeLibsDir "${rootProject.androidNdkOut}"
strippedNativeLibsDir "${rootProject.androidNdkLibsOut}"
}
}
debug {
firebaseCrashlytics { // If I comment this block, no gradle sync error
nativeSymbolUploadEnabled false
}
}
}
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:30.2.0')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-crashlytics-ndk'
}
project gradle:
buildscript {
ext {
androidNdkOut = "...."
androidNdkLibsOut = "...."
}
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
}
}
Am I missing anything? I've noticed that this type of error groovy.lang.MissingMethodException: No signature of method: appears when an incorrect syntax is used in the gradle file.
e.g.
firebaseCrashlytics {
nativeSymbolUploadEnabled true
unstrippedNativeLibsDir "${rootProject.androidNdkOut}"
strippedNativeLibsDir "${rootProject.androidNdkLibsOut}" {} // this random open/close brackets will cause an error
}
Perhaps this there is an incorrect syntax in your gradle file? Also any chance you could share an MCVE? It'll greatly help us in our investigation, thanks!
Hi @argzdev , Thanks for your reply.
Actually, this firebaseCrashlytics which I am having is in dynamic-feature module. Below is my complete dynamic-feature module gradle file.
apply plugin: 'com.android.dynamic-feature'
apply plugin: 'checkstyle'
apply plugin: 'com.google.firebase.crashlytics'
ext.androidNdkOut = "${rootProject.rootDir}/<MODULE>/build/unstrippedNativeLibsDir"
ext.androidNdkLibsOut = "${rootProject.rootDir}/<MODULE>/build/strippedNativeLibsDir"
android {
compileSdkVersion versions.compileSdk
defaultConfig {
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
manifestPlaceholders = [ isDynamicDeliveryEnabled:"true" ]
}
buildTypes {
release {
firebaseCrashlytics {
nativeSymbolUploadEnabled true
unstrippedNativeLibsDir "${project.androidNdkOut}"
strippedNativeLibsDir "${project.androidNdkLibsOut}"
}
}
debug {
firebaseCrashlytics {
nativeSymbolUploadEnabled false
}
}
}
flavorDimensions 'default'
productFlavors {
flavor_1 {
manifestPlaceholders = [ isDynamicDeliveryEnabled:"true" ]
}
flavor_2 {
manifestPlaceholders = [ isDynamicDeliveryEnabled:"true" ]
}
flavor_3 {
manifestPlaceholders = [ isDynamicDeliveryEnabled:"false" ]
}
}
repositories {
mavenCentral()
flatDir {
dirs 'src/main/libs'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
check.dependsOn 'checkstyle'
checkstyle {
toolVersion = '7.6'
configFile file("${rootProject.rootDir}/config/checkstyle/checkstyle.xml")
}
task checkstyle(type: Checkstyle) {
source 'src'
include '**/*.java'
exclude '**/gen/**'
classpath = files()
}
gradle.projectsEvaluated {
// Only needed manualRelease files as we are uploading symbols for release build types and manual flavour only
def buildTypeName = 'manualRelease'
task "deleteAndroidNdkOut${buildTypeName}"(type: Delete) {
delete "${project.androidNdkOut}"
}
task "copyAndroidNdkOut${buildTypeName}"(type: Copy, dependsOn: "deleteAndroidNdkOut${buildTypeName}") {
if (org.gradle.internal.os.OperatingSystem.current().windows) {
from "$buildDir/../<MODULE>/intermediates/merged_native_libs/${buildTypeName}/out/lib"
} else {
from "${rootProject.rootDir}/<MODULE>/build/intermediates/merged_native_libs/${buildTypeName}/out/lib"
}
into "${project.androidNdkOut}"
}
task "deleteAndroidNdkLibsOut${buildTypeName}"(type: Delete) {
delete "${project.androidNdkLibsOut}"
}
task "copyAndroidNdkLibsOut${buildTypeName}"(type: Copy, dependsOn: "deleteAndroidNdkLibsOut${buildTypeName}") {
if (org.gradle.internal.os.OperatingSystem.current().windows) {
from "$buildDir/../<MODULE>/intermediates/stripped_native_libs/${buildTypeName}/out/lib"
} else {
from "${rootProject.rootDir}/<MODULE>/intermediates/stripped_native_libs/${buildTypeName}/out/lib"
}
into "${project.androidNdkLibsOut}"
}
task "copyAndroidNdkOutDirs${buildTypeName}"(dependsOn: ["copyAndroidNdkOut${buildTypeName}", "copyAndroidNdkLibsOut${buildTypeName}"])
}
dependencies {
implementation project(':<APP_MODULE>')
implementation(name:'xxlib', ext:'aar')
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation platform('com.google.firebase:firebase-bom:28.0.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-crashlytics-ndk'
}
- I checked the syntax and it is as same as I added in issue description.
- I am not seeing any issue in my other application module.
- Also, I haven't observed this issue in
firebase-crashlytics-gradle:2.8.0and below.
Hope, this info is helpful to debug more.
Thanks for the extra details, @WIPSivaG. I was able to reproduce the same behavior. I'll notify an engineer and see what we can do here.
I took a look at this, and here is what's going on. The google-services plugin isn't generating a task for the dynamic module, and the Crashlytics plugin depends on that. I hacked together something just to get it working, but it's pretty ugly. You can play with it if you want. But I would recommend using our Firebase CLI tool to upload native symbols instead. Either way, you need to run an extra gradle task or run an extra command.
// Similar setup, but for dynamic feature modules.
project.pluginManager.withPlugin("com.android.dynamic-feature") {
externalPluginsState = ExternalPluginsState.deriveFrom(project)
configureExtension()
project.afterEvaluate {
project.android.applicationVariants.all { appVariant ->
ProjectVariantState.Provider variantStateProvider =
new ProjectVariantState.Provider(project, appVariant)
registerCrashlyticsTasks(project, variantStateProvider)
}
}
}
...
// Needed because we don't have the google-services plugin task.
project.afterEvaluate {
tasks.named("uploadCrashlyticsSymbolFileDebug") {
DirectoryProperty resRoot = project.objects.directoryProperty().fileValue(file("../app/build/generated/res/google-services/debug/"))
googleServicesResourceRoot.value(resRoot)
}
}
If neither of these works for you, feel free to reopen this issue.