Rate This Document
Findability
Accuracy
Completeness
Readability

"Connection refused" Displayed During Gradle Compilation

Symptom

The message "Connection refused" is displayed during Gradle compilation.

Key Process and Cause Analysis

An attempt is made to establish a connection, but the connection is rejected by the remote server or local service.

Conclusion and Solution

  1. Create build.sh.
    1
    vim build.sh
    
  2. Press i to enter the insert mode and add the following content to the script:
    ./gradlew
    while [ $? -ne 0 ]
    do
    sleep 3
    ./gradlew
    done
  3. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Run the script.
    1
    sh build.sh