问题
I have no Internet connection at all in my development environment, even temporary Internet is not an option.
I have received Android project, but I cannot compile it at all.
I get the following message:
"No cached version of com.android.tools.build:gradle:2.1.2
available for offline mode"
Can I provide the dependencies/caches/etc manually?
回答1:
MY SOLUTION
Simply Go in :
File > Settings > Build, Execution, Deployment > Gradle > Unchecked Offline Mode
Now Run your app in device if it's 1st time successfully installed then You go in Setting same as above path
AND Checked Offline Mode
Now your Offline Mode working fine. :)
回答2:
Well, Gradle needs to download the dependencies from the declared repositories once to have them in its cache and then being able to use those cached versions in offline mode.
If that is not an option, you can instead build a local repository with the needed dependencies and write a Gradle init script that replaces all declared repositories with your local repository, then Gradle can take the dependencies from your local repository.
来源:https://stackoverflow.com/questions/45958541/no-cached-version-of-gradle-available-for-offline-mode