firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.26k stars 573 forks source link

No signature of method: build_*.android() is applicable for argument types #2118

Closed aliyazdi75 closed 3 years ago

aliyazdi75 commented 3 years ago

[REQUIRED] Step 2: Describe your environment

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

I am using Flutter and NDK supported. My project works property with the Kotlin Plugin version. I used the following codes from https://firebase.google.com/docs/crashlytics/ndk-reports

android {

    ndkVersion '21.3.6528147'

    buildTypes {
        release {
            signingConfig signingConfigs.release
            ndk {
                debugSymbolLevel 'SYMBOL_TABLE'
            }
            firebaseCrashlytics {
                // Enable processing and uploading of native symbols to Crashlytics servers.
                // By default, this is disabled to improve build speeds.
                // This flag must be enabled to see properly-symbolicated native
                // stack traces in the Crashlytics dashboard.
                nativeSymbolUploadEnabled true
            }
        }
    }
}

dependencies {
    implementation platform('com.google.firebase:firebase-bom:26.0.0')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.firebase:firebase-crashlytics-ndk'
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

but it goes to this Gradle error when I run Gradle on step 3:

* What went wrong:
A problem occurred evaluating project ':app'.
> No signature of method: build_d8x6vzm4zppddwswq012dxidd.android() is applicable for argument types: (build_d8x6vzm4zppddwswq012dxidd$_run_closure2) values: [build_d8x6vzm4zppddwswq012dxidd$_run_closure2@20ed0a07]

When I remove firebaseCrashlytics bloc it will be ok.

yberstad commented 3 years ago

I'm having the exact same issue in my React Native app. @aliyazdi75 did you find any solution?

I'm running:

aliyazdi75 commented 3 years ago

@yberstad Just remove firebaseCrashlytics bloc for temporary solution.

yberstad commented 3 years ago

@aliyazdi75, thanks for getting back to me.

I noticed the same, but then I will not get any "properly-symbolicated native stack traces in the Crashlytics dashboard". Then again, that's maybe a minor issue?

aliyazdi75 commented 3 years ago

@yberstad Yes, we didn't really implement native stack traces in Crashlytics. We have to implement as it says after this issue got fixed I think.

nikhilbpatil222 commented 3 years ago

I Also Got Same Error After Searching So Much In Code i Found Problem in Version Code of my app it was in DECIMAL that's why i got the error after rounding it to integer my error was solved . HOPE YOU GOT THE RIGHT ANSWER THANK YOU.

vkryachko commented 3 years ago

I assume you've applied the crashlytics plugin to your app's build.gradle?

aliyazdi75 commented 3 years ago

@vkryachko Yes, Sorry for that. I updated it.

pasmat commented 3 years ago

For me this was fixed by removing

crashlytics { instantAppSupport true }

Not sure yet if crashlytics work on instant apps now or not - can't find any info on this

androideveloper commented 3 years ago

For me similar issue was related to kotlin android extensions plugin. After updating Kotlin and removing the plugin, forgot to also remove this

    androidExtensions {
        experimental = true
    }
mrichards commented 3 years ago

Hey folks, I apologize for this ticket getting so stale, as it didn't get assigned properly. Based on the error message, I believe the resolution is simply to make sure the Crashlytics plugin is applied before the android block in the app-level Gradle file. Typically it is applied immediately after the Android Gradle plugin and Google Services plugins are applied, as show in Step 2.2 of the Getting Started instructions.

Please reopen the ticket if you are still experiencing problems!

aliyazdi75 commented 3 years ago

@mrichards Thanks, it works for me, but I remember the order wasn't like that, but anyway, this is my final gradle:

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

dependencies {
    implementation platform('com.google.firebase:firebase-bom:26.7.0')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.firebase:firebase-crashlytics-ndk'
}

android {
    buildTypes {
        release {
            signingConfig signingConfigs.release
            ndk {
                debugSymbolLevel 'SYMBOL_TABLE'
            }
            firebaseCrashlytics {
                // Enable processing and uploading of native symbols to Crashlytics servers.
                // By default, this is disabled to improve build speeds.
                // This flag must be enabled to see properly-symbolicated native
                // stack traces in the Crashlytics dashboard.
                nativeSymbolUploadEnabled true
                strippedNativeLibsDir 'build/intermediates/stripped_native_libs/release/out/lib'
                unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib'
            }
        }
    }
}
mrichards commented 3 years ago

Glad you got it working @aliyazdi75!

Note that you should remove the strippedNativeLibsDir property as it is no longer used by the plugin and will be removed at a later date. You will still need the unstrippedNativeLibsDir property if you are continuing to override the default unstripped libs location.