One way you could do this is to gather all of your dependencies in an
archive. For example, something like this should grab everything in
all configurations:
task bundleDependencies(type: Zip) {
baseName = 'dependencies'
configurations.each { configuration ->
if (configuration.canBeResolved) { from configuration }
}
destinationDir = file('your/Path') // set path
}
Transfer the archive to the offline machine, extract, and use a
flatDir repository (maybe conditionally if you want to use it when
offline without adding it each time):
If you don’t know your package name just take a look at build.gradle(app level). In the dependency block you can find it like:
Implemented ‘your.package.name:your lib name:your_lib_version’
# 1 楼答案
你可以copy the gradle cache
然后使用gradle的
offline
参数在C2上运行您可以使用Zip、Tar或Jar任务导出依赖项,具体取决于您的喜好。见creating archives
也只是简单的复制。从C1到C2的同一位置的渐变目录(因为绝对路径)应该可以工作
# 2 楼答案
谢谢大家。解决办法是: 1.向联机计算机添加依赖项。(gradle将在“.gradle\caches\modules-2\files-2.1\${YOUR.PACKAGE.NAME}\${YOUR LIB NAME}\${YOUR_LIB_VERSION}{HASH_FOLDER}\”)中生成并缓存.aar文件
二,。抄袭。aar文件
三,。在脱机计算机中打开android studio,然后在项目视图(左上角)中将android更改为project。然后转到应用程序文件夹,您可以看到“libs”文件夹
四,。拖放。aar文件到libs并单击“确定我仍要修改此文件”
五,。然后去建造。gradle(应用程序级别)并将此代码粘贴到:
六,。将此行放在生成中的依赖项块中。gradle(应用程序级)