Because the intranet cannot connect to the external network, there are some problems when compiling an Android studio project with Gradle:
1.Gradle installation file could not be downloaded
2.Gradle Android plugin cannot be downloaded
3. Project dependent files cannot be downloaded
Painstaking, through groping, found some solutions to share with you
Developing machine Information:
Operating system: Windows
Information about the server:
IP Address: 192.68.121.130
Operating system: SUSE Linux Enterprise Server SP4 (x86_64)
Java version: 1.8.0_144
Tomcat version: 7.0.70
Gradle installation file directory:/home/jack/desktop/jack/software/gradle
Android App Info:
Gradle Android Plugin version: 2.3.3
Gradle Wrapper version: 3.3
Dependent files:
butterknife:8.4.0
Resolves an issue where gradle installation files cannot be downloaded in an intranet environment
1 Installing Tomcat on the server
1.1 Download Tomcat 7.0.70 from the Tomcat website, address:
https://archive.apache.org/dist/tomcat/tomcat-7/v7.0.70/bin/apache-tomcat-7.0.70.tar.gz
1.2 Unzip Tomcat, execute the following command
Tar zxvf apache-tomcat-7.0.70.tar.gz
If the directory for Tomcat after decompression is:
/home/jack/desktop/jack/software/apache-tomcat-7.0.70
1.3 Set the environment variable tomcat_home to:
/home/jack/desktop/jack/software/apache-tomcat-7.0.70
1.4 Start Tomcat and execute the following command:
CD $TOMCAT _home
SH bin/startup.sh
2. Create a soft link:
CD $TOMCAT _home/webapps
ln-s/home/jack/desktop/jack/software/gradle Gradle
3. Upload the Gradle-3.3-all.zip to the server/home/jack/desktop/jack/software/gradle directory
When you access Http://192.168.121.130:8080/gradle/gradle-3.3-all.zip, if you can download the file, the configuration succeeds
4. Replace the distributionurl of the Gradle-wrapper.properties file in the project
5. Execute gradlew–v under the project root, if there is no local cache gradle 3.3 will first download gradle-3.3-all.zip from the server and cache to local (the default local cache directory is C:\Users\xxx\.gradle \wrapper\dists), and then execute the command
Android Project Gradle Intranet configuration