Host name may not be empty
Asked Answered
T

9

21

After upgrading my Android Studio, I got this error whenever I wanted to generate a signed Apk (without any detail of where the problem is). There was no problem when I just built Apk.

The Host name may not be empty
Tobitobiah answered 1/6, 2020 at 8:32 Comment(0)
T
51

Check your Gradle scripts root. If there is this file: gradle.properties (Global Properties), check that values are correct.

In my case, I removed all these properties and my problem solved

systemProp.http.proxyHost=
systemProp.http.proxyPort=80
systemProp.https.proxyHost=
systemProp.https.proxyPort=80
Tobitobiah answered 1/6, 2020 at 8:32 Comment(5)
@RaviParmar maybe this error occurs in different cases. For my problem, It workedTobitobiah
File location: ~/.gradle/gradle.propertiesImmaterialism
I have same issue but this solution not working for meSpoken
for windows it was located in C:\Users\{username}\.gradle\ folderBader
To be more specific it is system level ./gradle dir having gradle.properties file. e.g for mac path is /Users/[username]/.gradle/gradle.propertiesImparipinnate
Z
13

It may be problem with uploadMappingFile

Set the firebaseCrashlytics.enableMappingFileUpload Gradle extension property to true in your app-level build.gradle file.

// To enable Crashlytics mapping file upload for specific product flavors:
  flavorDimensions "environment"
  productFlavors {
    staging {
      dimension "environment"
      ...
      firebaseCrashlytics {
        mappingFileUploadEnabled false
      }
    }
    prod {
      dimension "environment"
      ...
      firebaseCrashlytics {
        mappingFileUploadEnabled true
      }
    }
  }

for more details visit here

Zachary answered 20/6, 2020 at 12:13 Comment(1)
This helped me. Many other suggestions did not, but this one did. Thank youFreeswimming
C
10

Yep, problem started at AS 4.0 up.. Here are the clearer fixes... (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

Corin answered 3/12, 2021 at 3:45 Comment(1)
Thank you for adding pictures. It definitely works.Mader
L
0

I got the same issue, I fixed that issue by applying Proguard rules,

https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=android

In project proguard-rules.pro

-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception

Gradle

firebaseCrashlytics { mappingFileUploadEnabled true }

Lui answered 7/11, 2021 at 9:42 Comment(0)
N
0

This issue is caused due to empty xml file in your res directory. Open the res directory in explorer/finder sort all the xml according to their size. Find the xml with 0kb / empty xml and delete it. Now you can create your signed bundled apk.

Nevil answered 24/1, 2022 at 10:23 Comment(0)
P
0

When I removed all the http.proxyPort then it works.

Patric answered 7/4, 2022 at 9:0 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Ahasuerus
S
0

For me, the issue was WebDriver requiring a fully qualified url. Switching from localhost:9000 to http://localhost:9000/ did the trick for me (hopefully helps others too).

This is because the WebDriver method void get(String url); was being called and giving the error:

The Host name may not be empty

The java doc for the param states:

Params: url – The URL to load. Must be a fully qualified URL

Stillhunt answered 29/4, 2022 at 11:25 Comment(0)
W
0

For Mac users check your gradle.properties file located at /Users/[username]/.gradle/gradle.properties and remove the following properties

systemProp.http.proxyHost=
systemProp.http.proxyPort=80
systemProp.https.proxyHost=
systemProp.https.proxyPort=80
Wadi answered 26/4, 2023 at 8:45 Comment(0)
A
0

To go to global gradle as stated in Mona Bahalou's answer:

Type cd ~/.gradle and press Enter. Then type open . and press Enter to open the .gradle folder in Finder.

You can now remove necessary properties.

Afrikaner answered 30/4 at 14:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.