In an Android studio project, the default remote repository is Jcenter, and if some class libraries are referenced in the project, Gradle will download these dependent class libraries from the Jcenter Web site to local when the program is built, as we Build.gradle uses the following dependencies:
dependencies { compile ' de.hdodenhof:circleimageview:2.1.0 '}
The download address is: https://jcenter.bintray.com/de/hdodenhof/circleimageview/2.1.0/
The local cache address is: C:\Users\xxx (user name)\.gradle\caches\modules-2\files-2.1\de.hdodenhof\circleimageview\2.1.0
These three directories store files in turn Circleimageview-2.1.0.pom,circleimageview-2.1.0.aar,circleimageview-2.1.0-sources.jar
If there is no network or if we set Gradle to offline mode, Gradle will use these cache files and no longer connect Jcenter to obtain these dependent packages
Many companies in the office network, taking into account the security, confidentiality and other factors, is not allowed to connect to the external network or inaccessible to Jcenter, then how to use Gradle build Android program in the network? This is a difficult question, ah, let me give up the beloved Butterknife,rxjava ...? Do you want me to copy a bunch of jar packages into the Libs directory?
Smart programmers are obviously not going to do this, research, and found that in the context of the network, we can still happily use Gradle to build Android projects
This assumes that extranet computer A, intranet PC B, if we need to use Circleimageview in the project, then copy the Circleimageview class library in a cache to the corresponding directory in the Android SDK Extras directory in B.
Copy the Circleimageview-2.1.0.pom,circleimageview-2.1.0.aar,circleimageview-2.1.0-sources.jar file cached in A to B in xxx ( Android SDK directory) \extras\m2repository\de\hdodenhof\circleimageview\2.1.0 Directory
If we use Butterknife in our project, here are the following:
dependencies { compile ' com.jakewharton:butterknife:8.4.0 ' annotationprocessor ' Com.jakewharton: Butterknife-compiler:8.4.0 '}
So how do we use Butterknife in the intranet? Since the Butterknife project references the Javapoet,auto-common,auto-service class library, we also need to place these libraries in the Extras directory
Build an Android Studio project on the intranet using Gradle