After upgrading my Android Studio to 2021.1.1, I got this error when try to generate a signed Apk. There was no problem when I debugging the application emulator or remote on true phone.
I've tried to follow this patch: 1-insert the firebaseCrashlytics mappingFileUploadEnabled true
dependencies {
classpath 'com.android.tools.build:gradle:7.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
classpath 'com.google.gms:google-services:4.3.10'
// Add the Crashlytics Gradle plugin.
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
compileSdkVersion 32
defaultConfig {
applicationId "com_pro.bandweb.mycpstore"
minSdkVersion 23
targetSdkVersion 32
// versionCode 1
//versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
if (!localProperties['base64EncodedPublicKey']) {
logger.warn('base64EncodedPublicKey must be set for signature verification. ' +
'You can add it to local.properties once you have gotten it from Play. ' +
'Example: base64EncodedPublicKey=[key value]')
}
buildConfigField("String", "BASE64_ENCODED_PUBLIC_KEY", "\"" + localProperties['base64EncodedPublicKey'] + "\"")
}
buildTypes {
release {
// Enables code shrinking, obfuscation, and optimization for only
// your project's release build type.
minifyEnabled true
// Enables resource shrinking, which is performed by the
// Android Gradle plugin.
shrinkResources true
// Includes the default ProGuard rules files that are packaged with
// the Android Gradle plugin. To learn more, go to the section about
// R8 configuration files.
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
debuggable false
// To enable Crashlytics mapping file upload for specific product flavors:
firebaseCrashlytics {
mappingFileUploadEnabled true
}
}
debug {
debuggable true
//applicationIdSuffix ".dev"
signingConfig signingConfigs.config
// To enable Crashlytics mapping file upload for specific product flavors:
firebaseCrashlytics {
mappingFileUploadEnabled false
}
}
}
2- delete this line in this file: gradle.properties (Global Properties)(link)
systemProp.http.proxyHost=
systemProp.http.proxyPort=80
systemProp.https.proxyHost=
systemProp.https.proxyPort=80
but nothing of this tricks had success the error are always the same:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:uploadCrashlyticsMappingFileRelease'.
> Host name may not be empty
UPDATE The only workaround that I found is to set to false under release but I didn't want to give up to Crashlytics
firebaseCrashlytics {
mappingFileUploadEnabled false
}