配置离线构建依赖项

配置离线构建依赖项

本文介绍了Android Studio:配置离线构建依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天,我按照配置您的Android Studio页面"中的说明安装了离线构建依赖项(可在此处找到 https://developer.android.com/studio/intro/studio-config#offline ).下载了gradle插件和maven依赖项,将它们解压缩到所需的文件夹中,还创建了offline.gradle文件,并将其放置在适当的文件夹中.但是,在指南中,据说要测试它是否正常工作,需要在build.gradle文件中注释存储库.问题是一旦我这样做.我的项目无法建立.

Good day, I followed the instructions in the "Configure you Android Studio Page" to install offline build dependencies(found here https://developer.android.com/studio/intro/studio-config#offline). Downloaded the gradle plugin and the maven dependencies, unzipped them into the required folder, and also created the offline.gradle file, putting it in the appropriate folder. However, in the guide, it was said that to test it is working, one needs to comment the repositories in the build.gradle file. The problem is once I do this. My project fails to build.

在此方面的任何帮助,我将不胜感激.我的SDK:Android 10(API 29)我所知道的:android gradle插件(我从主站点下载)是3.5.0-beta01

I would appreciate any help with this.My SDK : Android 10(API 29)What I know: The android gradle plugin(I downloaded from the main site) is 3.5.0-beta01

当我检查.android/manual-offline-m2/gmaven_stable/com/android/tools/build/gradle/时,我看到的文件夹范围是3.0.0到3.4.0

When I check .android/manual-offline-m2/gmaven_stable/com/android/tools/build/gradle/ I see folders ranging from 3.0.0 to 3.4.0

依赖关系中的类路径(在我的应用程序的build.gradle中)为'com.android.tools.build:gradle:3.6.1'

The classpath in dependencies (in the build.gradle of my app) is 'com.android.tools.build:gradle:3.6.1'

distributionUrl(gradle-wrapper.properties)指向https://services.gradle.org/distributions/gradle-5.6.4-all.zip

The distributionUrl (gradle-wrapper.properties) points to https://services.gradle.org/distributions/gradle-5.6.4-all.zip

我得到的错误说:配置根项目"TestingOfflineBuildApp"时发生问题.无法解析配置':classpath'的所有工件.找不到com.android.tools.build:gradle:3.6.1.在以下位置搜索:

The ERROR I get says:A problem occured configuring root project 'TestingOfflineBuildApp'.Could not resolve all artifacts for configuration ':classpath'.Could not find com.android.tools.build:gradle:3.6.1.Searched in the following locations:

如果我将类路径从3.6.1更改为3.5.0-beta01,则错误更改为this(第二张图片).错误1 错误2 谢谢

If I change the classpath from 3.6.1 to 3.5.0-beta01, the errors change to this(second pic).Error 1Error 2Thank you

推荐答案

解决方案是

  1. (如果这样的错误显示为我们的存储库在本地存储库中的正确位置",则表明该设置正常,我们的设置可以正常工作)图像:错误显示如下

  1. (If error shows like this with "correct location of our set repo in local repo", then its fine,our setting is working fine)image: Error Shows like this

取消注释我们之前评论的注释, classpath 和其他内容应该相同,无需更改.图片:构建成功

Uncomment the comments which we commented earlier, classpath and other things should be same ,no need to change.image: Build Successfully


注意:-(如果执行上述步骤后,如果离线构建失败,请遵循此步骤


Notes:- (follow this if offline build failed occurs after doing above steps)

  • 在build.gradle文件的CLASSPATH中设置的哪个android gradle插件版本[如果本地版本库"或缓存中不存在新的Android Gradle插件"版本,则需要互联网一次. /li>
  • "init.d"目录中的"offline.gradle"初始化脚本在构建开始时执行.
  • 有关更多详细信息,您可以从此处阅读 https://developer.android. com/studio/build/dependencies

有关Maven vs Gradle的更多详细信息 https://dzone.com/articles/gradle-vs-maven

For more details about Maven vs Gradlehttps://dzone.com/articles/gradle-vs-maven

这篇关于Android Studio:配置离线构建依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 09:38