No cached version of gradle available for offline mode

和自甴很熟 提交于 2021-01-28 10:16:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!