Closed WIPSivaG closed 1 year ago
I found a few problems with this issue:
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'
}
firebase-crashlytics-gradle:2.8.0
and 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.
[REQUIRED] Step 2: Describe your environment
[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
to2.9.1
, gradle sync is failing with below error.If I comment out firebaseCrashlytics under buildTypes, I am not facing any gradle sync error, but I may not able to upload symbol file.
Steps to reproduce:
2.7.1
to2.9.1
Relevant Code:
./build.gradle
./dynamic_module/build.gradle
firebaseCrashlytics
block, gradle sync is fine.com.google.firebase:firebase-crashlytics-gradle:2.8.1
onwards.