Tasks to upload debug symbols to Crashlytics are not generated.
I have created a template project that Android Studio provides by default and set up Firebase Crashlytics NDK as described here https://firebase.google.com/docs/crashlytics/ndk-reports-new-sdk#enable-symbol-uploading. Project successfully compiled (release build type) and appeared in Firebase Console but when I try to call gradlew uploadCrashlyticsSymbolFileRelease there is an error:
Task 'uploadCrashlyticsSymbolFileRelease' not found in root project 'Template'.
or
Task 'uploadCrashlyticsSymbolFileRelease' not found in project 'app'.
Also, I do not forget to add this code to build type release:
buildTypes {
getByName("release") {
.....
firebaseCrashlytics {
nativeSymbolUploadEnabled = true
}
.....
}
}
After assembleRelease command can call gradlew :app:uploadCrashlyticsSymbolFileRelease
Tasks uploadCrashlyticsSymbolFile<BuildVariant> are not even generated
I found a few problems with this issue:
Ok, the problem appears when I use gradle kts files instead of gradle. Is there any solution for gradle kts?
The problem is really that I use build.gradle.kts instead of build.gradle. I think, that the language (KTS or Groovy) should not affect the creation of tasks and the whole Crashlytics plugin.
Also with build.gradle.kts the task generateCrashlyticsSymbolFileRelease always failed with NullPointerException (no message)
I ran into the same issue when migrating from Fabric to Firebase Crashlytics. Any news on how to get it working with gradle kts?
I did not find any solution except that I made this piece of code in groovy and imported it into kts. But this also not fully work because Firebase Crashlytics NDK throws NullPointerException. Issue #1357
I used withGroovyBuilder to work around.
withGroovyBuilder {
"firebaseCrashlytics" {
"nativeSymbolUploadEnabled"(true)
}
}
Thanks in advance! I'll try it.
Hi, I received this issue while trying using withGroovyBuilder
Could not find method firebaseCrashlytics() for arguments [org.gradle.kotlin.dsl.GroovyBuilderScope$closureFor$1@6140bb17]
tldr: you need to case buildType to ExtensionAware for correct behavior, using the following should fix your issues.
buildTypes {
getByName("release") {
.....
(this as ExtensionAware).configure<CrashlyticsExtension> {
nativeSymbolUploadEnabled = true
}
.....
}
}
The problem is that the way kotlin dsl works is by adding an extension method configure() to all ExtensionAware classes. While BuildType is ExtensionAware at runtime, it is not declared in its definition, as a result kotlin does not call configure() on the buildType, but on the project itself, this results in incorrect behavior.
Please reopen the issue if the above does not solve the problem
@vkryachko no, this not works too. But solution with withGroovyBuilder works. I think, the problem is between how KTS and plain Groovy work, but I don't know what exactly.
@personshelldon Interesting, I was able to successfully build with the fix I suggested above.
When you say that it does not work, do you mean you get the same error as in your original post or some thing else?
@vkryachko, sorry, it builds correctly with your fix, but when I try to call uploadCrashlyticsSymbolFileRelease for release build, gradle says that task not found
Also, configure<CrashlyticsExtension> it's a syntax that used for plugins that aplied via apply call (runtime apply). But kts uses plugins block to import plugins and generate synthetic accesors. I think that must work as it meant to be.
iiuc gradle only generates symbols for the Project object, not all nested ExtensionAware ones. i.e. here's all that gradle generated for my build:
https://gist.github.com/vkryachko/bfb0ae11b19ee81ce5d1d968c89b8333
Hm, I do not know about that, thanks. That means that we can write custom crashlitcs plugin in project scope to properly configure firebase crashlytics. Plugin is only for correct generation of synthetic accessors.
Most helpful comment
I used
withGroovyBuilderto work around.