Upgrade to Crashlytics Gradle plugin v3

The latest release of the Crashlytics Gradle plugin is a major version (v3.0.0) and modernizes the SDK by dropping support for lower versions of Gradle and the Android Gradle plugin. Additionally, the changes in this release resolve issues with AGP v8.1+ and improve support for native apps and customized builds.

Minimum requirements

Crashlytics Gradle plugin v3 has the following minimum requirements:

  • Android Gradle plugin 8.1+
    Upgrade this plugin using the Android Gradle plugin Upgrade Assistant on the latest version of Android Studio.

  • Firebase's google-services Gradle plugin 4.4.1+
    Upgrade this plugin by specifying the latest version in your project's Gradle build file, like so:

Kotlin

 plugins 
  
 { 
  
 id 
 ( 
 "com.android.application" 
 ) 
  
 version 
  
 " 8.1.4 
" 
  
 apply 
  
 false 
  
 id 
 ( 
 "com.google.gms.google-services" 
 ) 
  
 version 
  
 " 4.4.3 
" 
  
 apply 
  
 false 
  
 ... 
 } 

Groovy

 plugins 
  
 { 
  
 id 
  
 'com.android.application' 
  
 version 
  
 ' 8.1.4 
' 
  
 apply 
  
 false 
  
 id 
  
 'com.google.gms.google-services' 
  
 version 
  
 ' 4.4.3 
' 
  
 apply 
  
 false 
  
 ... 
 } 

Changes to the Crashlytics extension

With v3 of the Crashlytics Gradle plugin, the Crashlytics extension has the following breaking changes:

  • Removed the extension from the defaultConfig android block. Instead, you should configure each variant.

  • Removed the deprecated field mappingFile . Instead, the merged mapping file is now provided automatically.

  • Removed the deprecated field strippedNativeLibsDir . Instead, you should use unstrippedNativeLibsDir for all native libs.

  • Changed the field unstrippedNativeLibsDir to be cumulative.

    View an example with multiple directories

      
     buildTypes 
      
     { 
      
     release 
      
     { 
      
     configure<CrashlyticsExtension> 
      
     { 
      
     nativeSymbolUploadEnabled 
      
     = 
      
     true 
      
     unstrippedNativeLibsDir 
      
     = 
      
     file 
     ( 
     " MY/NATIVE/LIBS 
    " 
     ) 
      
     } 
      
     } 
      
     productFlavors 
      
     { 
      
     flavorDimensions 
      
     += 
      
     "feature" 
      
     create 
     ( 
     "basic" 
     ) 
      
     { 
      
     dimension 
      
     = 
      
     "feature" 
      
     // ... 
      
     } 
      
     create 
     ( 
     "featureX" 
     ) 
      
     { 
      
     dimension 
      
     = 
      
     "feature" 
      
     configure<CrashlyticsExtension> 
      
     { 
      
     unstrippedNativeLibsDir 
      
     = 
      
     file 
     ( 
     " MY/FEATURE_X/LIBS 
    " 
     ) 
      
     } 
      
     } 
      
     } 
      
     } 
      
    

    The uploadCrashlyticsSymbolFilesBasicRelease task will only upload the symbols in MY/NATIVE/LIBS , but uploadCrashlyticsSymbolFilesFeatureXRelease will upload symbols in both MY/NATIVE/LIBS and MY/FEATURE_X/LIBS .

  • Replaced the closure field symbolGenerator with two new top level fields:

    • symbolGeneratorType , a String of either "breakpad" (default) or "csym" .
    • breakpadBinary , a File of a local dump_syms binary override.
  • Example for how to upgrade the extension

    Kotlin

    Before
      
     buildTypes 
      
     { 
      
     release 
      
     { 
      
     configure<CrashlyticsExtension> 
      
     { 
      
     // ... 
      
     symbolGenerator 
     ( 
      
     closureOf<SymbolGenerator> 
      
     { 
      
     symbolGeneratorType 
      
     = 
      
     "breakpad" 
      
     breakpadBinary 
      
     = 
      
     file 
     ( 
     " /PATH/TO/BREAKPAD/DUMP_SYMS 
    " 
     ) 
      
     } 
      
     ) 
      
     } 
      
     } 
      
     } 
      
    
    Now in v3
      
     buildTypes 
      
     { 
      
     release 
      
     { 
      
     configure<CrashlyticsExtension> 
      
     { 
      
     // ... 
      
     symbolGeneratorType 
      
     = 
      
     "breakpad" 
      
     breakpadBinary 
      
     = 
      
     file 
     ( 
     " /PATH/TO/BREAKPAD/DUMP_SYMS 
    " 
     ) 
      
     } 
      
     } 
      
     } 
      
    

    Groovy

    Before
      
     buildTypes 
      
     { 
      
     release 
      
     { 
      
     firebaseCrashlytics 
      
     { 
      
     // ... 
      
     symbolGenerator 
      
     { 
      
     breakpad 
      
     { 
      
     binary 
      
     file 
     ( 
     " /PATH/TO/BREAKPAD/DUMP_SYMS 
    " 
     ) 
      
     } 
      
     } 
      
     } 
      
     } 
      
     } 
      
    
    Now in v3
      
     buildTypes 
      
     { 
      
     release 
      
     { 
      
     firebaseCrashlytics 
      
     { 
      
     // ... 
      
     symbolGeneratorType 
      
     "breakpad" 
      
     breakpadBinary 
      
     file 
     ( 
     " /PATH/TO/BREAKPAD/DUMP_SYMS 
    " 
     ) 
      
     } 
      
     } 
      
     } 
      
    
    Create a Mobile Website
    View Site in Mobile | Classic
    Share by: