maven - 如何离线创建android studio项目?

标签 maven android-studio android-gradle-plugin project offline

我想离线创建我的 Android 项目。我尝试了多种技术,但没有一个对我有用! 我已经从 developers.android.com 下载了离线组件(Android Gradle 插件和 Google Maven 依赖项)用于创建离线项目的网站,但问题是我不知道如何使它们与 android studio 一起工作?请帮忙!

最佳答案

正如这里所说的https://developer.android.com/studio/build/optimize-your-build#offline_mode (Android Studio < 3.6)

If you are on a slow network connection, your build times may suffer when Gradle attempts to use network resources to resolve dependencies. You can tell Gradle to avoid using network resources by using only the artifacts that it has cached locally.

To use Gradle offline when building with Android Studio, proceed as follows:

  • Open the Preferences window by clicking File > Settings (on Mac, Android Studio > Preferences).
  • In the left pane, click Build, Execution, Deployment > Gradle.
  • Check the Offline work checkbox.
  • Click Apply or OK.

If you're building from the command line, pass the --offline option.

[编辑]

https://developer.android.com/studio/releases/#3.6-gradle-offline-ui (Android Studio > 3.6)

New location to toggle Gradle's offline mode To enable or disable Gradle's offline mode, first select View > Tool Windows > Gradle from the menu bar.

Then, near the top of the Gradle window, click Toggle Offline Mode Gradle offline button in the Gradle panel..

每当添加依赖项时,都需要下载它。如果是这样,您需要建立连接。

您还可以通过网络连接导入所有依赖项,然后切换到离线模式。

关于maven - 如何离线创建android studio项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63653771/

相关文章:

java - 找不到Struts2标签

maven - Spring Boot Maven 插件包含资源

java - 如何为列表 JAXB 制作 setter

java - 为什么我收到 Maven 错误 : "Unable to determine if resource X exists in http://maven.glassfish.org/content/groups/glassfish"?

android-studio - Android Studio:Gradle Executin失败,并发生dexDebug错误

android - 如何从 Activity 类中获取上下文?

java - 使用 `==` 而不是 `equals()` 比较字符串时,如何使 Android Studio 或 IntelliJ 显示错误?

java - 无法将任务 'clean'添加为具有该名称的任务

android - 无法解决:com.android.support:cardview-v7:26.0.0 android

Android - ViewPager 在空对象引用上设置适配器