Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

enabling nativeSymbolUploadEnabled for multi variant application #5572

Unanswered
MahdiHatami asked this question in Q&A
Discussion options

androidComponents {
 beforeVariants { variant ->
 configure<CrashlyticsExtension> {
 unstrippedNativeLibsDir = "build/intermediates/merged_native_libs/$variant/out/lib"
 nativeSymbolUploadEnabled = true
 }
 }
 }

I'm trying to enable symbol file upload for crashlytics using above code, but getting this error org.gradle.api.UnknownDomainObjectException: Extension of type 'CrashlyticsExtension' does not exist.
I really appreciate if you could help me.
Thanks.

You must be logged in to vote

Replies: 4 comments 1 reply

Comment options

Hi @MahdiHatami, are you importing the extension?

#2665 (comment) has an example of how to use the Crashlytics + Kotlin DSL

You must be logged in to vote
0 replies
Comment options

Hi @rlazo , Yes I'm importing the extension

You must be logged in to vote
0 replies
Comment options

Could you share the whole gradle file and error message? Thanks!

You must be logged in to vote
1 reply
Comment options

Hi @rlazo
here is the rough picture of my gradle file, the idea is I'm trying to enable crashlytics native file upload for specific buildVariant:
e.g: FlavorARelease, FlavorBDebug, FlavorCStaging
Thanks!

 import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension
 buildTypes {
 getByName("release") {
 //
 }
 getByName("staging") {
 matchingFallbacks += listOf("release", "debug")
 }
 getByName("debug") {
 versionNameSuffix = "-debug"
 applicationIdSuffix = ".debug"
 ext.set("enableCrashlytics", false)
 }
 }
 productFlavors {
 create("flavorA") {
 dimension = "client"
 }
 create("flavorB") {
 dimension = "client"
 }
 create("flavorC") {
 dimension = "client"
 }
 }
 androidComponents {
 beforeVariants { variant ->
 configure<CrashlyticsExtension> {
 unstrippedNativeLibsDir = "build/intermediates/merged_native_libs/$variant/out/lib"
 nativeSymbolUploadEnabled = true
 }
 }
 }
Comment options

The CrashlyticsExtension does not register itself in anything to do with beforeVariants. It is registered in buildTypes and productFlavors. If you have multiple dimensions in your productFlavors I believe it follows the order you define them in, but I am not totally sure. You might be able to get away with just putting it in the first one.

You can exclude the unstrippedNativeLibsDir = "build/intermediates/merged_native_libs/$variant/out/lib" line because the plugin will get the variant's native libs directly from the appropriate Task in the AGP.

So instead, you can enable symbol uploading by putting this directly in each buildTypes and/or each productFlavors you want it in.

configure<CrashlyticsExtension> {
 nativeSymbolUploadEnabled = true
}
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /