Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execution failed for task ':app:uploadCrashlyticsMappingFileRelease'.Host name must not be empty

When trying to create a release signed apk, Build fails at task
app:uploadCrashlyticsMappingFileRelease'.Host name must not be empty.

I have enabled obfuscation .

buildTypes {

        release {

            minifyEnabled true // Enables code shrinking, obfuscation, and optimization

            shrinkResources true // Enables resource shrinking, which is performed by the Android Gradle plugin


            firebaseCrashlytics {

                mappingFileUploadEnabled true
            }

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

Also,using

    apply plugin: 'com.android.application'
    
       apply plugin: 'com.google.gms.google-services'
    
       // Apply the Crashlytics Gradle plugin
    
       apply plugin: 'com.google.firebase.crashlytics'
    
        implementation 'com.google.firebase:firebase-auth:20.0.1'
        implementation 'com.google.firebase:firebase-firestore:22.0.1'
        implementation 'com.google.firebase:firebase-core:18.0.0'
    
        //the Firebase SDK for Google Analytics.
        implementation 'com.google.firebase:firebase-analytics:18.0.0'
    
        //the Firebase Crashlytics SDK.
        implementation 'com.google.firebase:firebase-crashlytics:17.3.0'

and,

        classpath 'com.google.gms:google-services:4.3.4'  // Google Services plugin

        // Add the Crashlytics Gradle plugin.
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'

Anyone facing the same issue? I tried clearing gradle cache and removing crashlytics dependencies as i read that it will be automatically handled by Android Studio,but crashes are not recorded then.

Iam using Android Studio 4.1.1(upgraded from previous version)

Build #AI-201.8743.12.41.6953283, built on November 5, 2020 Runtime version: 1.8.0_242-release-1644-b3-6222593 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Linux 5.4.0-58-generic GC: ParNew, ConcurrentMarkSweep Memory: 1246M Cores: 4 Registry: ide.new.welcome.screen.force=true, external.system.auto.import.disabled=true Non-Bundled Plugins: com.android.tool.sizereduction.plugin Current Desktop: ubuntu:GNOME.

like image 887
ddk Avatar asked Jul 21 '26 10:07

ddk


2 Answers

There are Two possible fixes here...

First one which is a less likely solution is to rearrange the order of plugins in your build.gradle project file and bring apply plugin: 'com.google.firebase.crashlytics' right under the google-services top plugin call in your project's build.gradle file so that you have this arrangement on top BEFORE you call other libraries or apply other plugins needed So like this

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

enter image description here

- The second solution which is likely and started as at android studio 4.0 up is to edit your global gradle.propeties file installation on your computer...

Here is the clearer fix with pictures below... (Cos Some may think the "gradle.properties" file being talked about here is what is in the AS project instead of the global one.

Delete the following lines from the "gradle.propeties" file on your PC gradle installation location

systemProp.http.proxyHost= systemProp.https.proxyHost= systemProp.https.proxyPort=80 systemProp.http.proxyPort=80

as seen in n my picture below here is a typical file location of this gradle.propeties file enter image description here

enter image description here

Now click rebuild in your project and VIOLA... Problem solved

like image 172
Samuel Ewudzi Incoom Avatar answered Jul 23 '26 00:07

Samuel Ewudzi Incoom


To enable Crashlytics mapping file upload for specific product flavors:

import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension

android {
 buildTypes {
   getByName("debug") {
   minifyEnabled = true

   configure<CrashlyticsExtension> {
    mappingFileUploadEnabled = false
   }

 }
}


 
like image 43
Mohd Danish Avatar answered Jul 23 '26 01:07

Mohd Danish



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!