英文:
Android Studio : Could not download FastInfoset.jar (com.sun.xml.fastinfoset:FastInfoset:1.2.15): No cached version available for offline mode error
问题
我是 Android Studio 的新用户。最初,我遇到了一些问题,比如运行按钮被禁用,XML 显示没有内容。
当我尝试解决这些问题时,我遇到了一堆错误代码。
配置根项目 'Myfirstapp' 时出现问题。
> 无法解析配置 'classpath' 的所有构件。
> 无法下载 protobuf-java.jar (com.google.protobuf:protobuf-java:3.4.0):离线模式下没有可用的缓存版本
> 无法下载 bcpkix-jdk15on.jar (org.bouncycastle:bcpkix-jdk15on:1.56):离线模式下没有可用的缓存版本
> 无法下载 bcprov-jdk15on.jar (org.bouncycastle:bcprov-jdk15on:1.56):离线模式下没有可用的缓存版本
> 无法下载 fastutil.jar (it.unimi.dsi:fastutil:7.2.0):离线模式下没有可用的缓存版本
> 无法下载 jimfs.jar (com.google.jimfs:jimfs:1.1):离线模式下没有可用的缓存版本
> 无法下载 guava.jar (com.google.guava:guava:27.1-jre):离线模式下没有可用的缓存版本
> 无法下载 httpclient.jar (org.apache.httpcomponents:httpclient:4.5.6):离线模式下没有可用的缓存版本
> 无法下载 httpcore.jar (org.apache.httpcomponents:httpcore:4.4.10):离线模式下没有可用的缓存版本
> 无法下载 kotlin-reflect.jar (org.jetbrains.kotlin:kotlin-reflect:1.3.71):离线模式下没有可用的缓存版本
> 无法下载 antlr4.jar (org.antlr:antlr4:4.5.3):离线模式下没有可用的缓存版本
> 无法下载 juniversalchardet.jar (com.googlecode.juniversalchardet:juniversalchardet:1.0.3):离线模式下没有可用的缓存版本
> 无法下载 gson.jar (com.google.code.gson:gson:2.8.5):离线模式下没有可用的缓存版本
> 无法下载 kotlin-stdlib.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.71):离线模式下没有可用的缓存版本
> 无法下载 proguard-base.jar (net.sf.proguard:proguard-base:6.0.3):离线模式下没有可用的缓存版本
> 无法下载 jdom2.jar (org.jdom:jdom2:2.0.6):离线模式下没有可用的缓存版本
> 无法下载 commons-compress.jar (org.apache.commons:commons-compress:1.12):离线模式下没有可用的缓存版本
> 无法下载 trove4j.jar (org.jetbrains.trove4j:trove4j:20160824):离线模式下没有可用的缓存版本
> 无法下载 commons-codec.jar (commons-codec:commons-codec:1.10):离线模式下没有可用的缓存版本
> 无法下载 jaxb-runtime.jar (org.glassfish.jaxb:jaxb-runtime:2.3.1):离线模式下没有可用的缓存版本
> 无法下载 FastInfoset.jar (com.sun.xml.fastinfoset:FastInfoset:1.2.15):离线模式下没有可用的缓存版本
这是我面临的错误截图:
英文:
I am a new user of the android studio. Initially, I faced with problems like the run button being disabled, and the XML display showing nothing.
When I was trying to resolve these problems, I confront with a bunch of error codes.
A problem occurred configuring root project 'Myfirstapp'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not download protobuf-java.jar (com.google.protobuf:protobuf-java:3.4.0): No cached version available for offline mode
> Could not download bcpkix-jdk15on.jar (org.bouncycastle:bcpkix-jdk15on:1.56): No cached version available for offline mode
> Could not download bcprov-jdk15on.jar (org.bouncycastle:bcprov-jdk15on:1.56): No cached version available for offline mode
> Could not download fastutil.jar (it.unimi.dsi:fastutil:7.2.0): No cached version available for offline mode
> Could not download jimfs.jar (com.google.jimfs:jimfs:1.1): No cached version available for offline mode
> Could not download guava.jar (com.google.guava:guava:27.1-jre): No cached version available for offline mode
> Could not download httpclient.jar (org.apache.httpcomponents:httpclient:4.5.6): No cached version available for offline mode
> Could not download httpcore.jar (org.apache.httpcomponents:httpcore:4.4.10): No cached version available for offline mode
> Could not download kotlin-reflect.jar (org.jetbrains.kotlin:kotlin-reflect:1.3.71): No cached version available for offline mode
> Could not download antlr4.jar (org.antlr:antlr4:4.5.3): No cached version available for offline mode
> Could not download juniversalchardet.jar (com.googlecode.juniversalchardet:juniversalchardet:1.0.3): No cached version available for offline mode
> Could not download gson.jar (com.google.code.gson:gson:2.8.5): No cached version available for offline mode
> Could not download kotlin-stdlib.jar (org.jetbrains.kotlin:kotlin-stdlib:1.3.71): No cached version available for offline mode
> Could not download proguard-base.jar (net.sf.proguard:proguard-base:6.0.3): No cached version available for offline mode
> Could not download jdom2.jar (org.jdom:jdom2:2.0.6): No cached version available for offline mode
> Could not download commons-compress.jar (org.apache.commons:commons-compress:1.12): No cached version available for offline mode
> Could not download trove4j.jar (org.jetbrains.trove4j:trove4j:20160824): No cached version available for offline mode
> Could not download commons-codec.jar (commons-codec:commons-codec:1.10): No cached version available for offline mode
> Could not download jaxb-runtime.jar (org.glassfish.jaxb:jaxb-runtime:2.3.1): No cached version available for offline mode
> Could not download FastInfoset.jar (com.sun.xml.fastinfoset:FastInfoset:1.2.15): No cached version available for offline mode
Here is a screenshot of errors i am facing:
答案1
得分: 1
请确保在尝试同步项目之前拥有稳定的互联网连接,并检查您的代理设置。确保已勾选自动检测选项。在文件 > 设置 > 外观与行为 > 系统设置 > HTTP 代理中可以访问此选项,对于 Windows 来说。我确定对于 Linux 来说,路径是相同的。
要启用或禁用 Gradle 的离线模式,只需在 Android 3.6 上,在图像的右侧窗格中,在 gradle 下的第二个图标右侧
英文:
Make sure you have a stable internet connection before try to sync your project. an check your proxy settings. Make sure the auto detect option is checked. you can access it in Files > Settings > Appearance and Behavior > System Settings > HTTP proxy for windows though. Am sure for linux its the same path.
and to enable and disable gradle offline mode,, its just easy on android 3.6 an the right pane in the image second right icon under gradle
答案2
得分: 0
注意:如果您正在使用的是“Gradle离线”版本,这就是为什么缓存失败的原因(从左边数起的第6个按钮)。
如果取消激活“离线模式下没有可用的缓存版本”,错误将消失。
英文:
Note on Gradle you are using "Gradle offline" that is why the cache is failing (6th button from the left).
If deactivated the "No cached version available for offline mode" errors would disappear.
答案3
得分: 0
你目前正在使用离线模式。
要使用gradle
的离线模式,必须至少连接到互联网一次,以下载所需的依赖项
并缓存将在项目中使用的模块
。
禁用它的过程非常简单:
-
点击屏幕右侧的
gradle
一词。 -
一个面板将出现,其中包含一些信息和任务,从顶部工具栏(位于图片中
gradle
一词下方的工具栏)最右边,您将看到一个带有设置(配置)图标的按钮,在其左侧,有一个带有交叉线图标的突出按钮,单击它以启用在线模式。 -
您需要同步您的项目(您需要访问互联网),方法是转到文件 -> 与gradle文件同步项目。
-
然后运行 -> 重建,以构建项目并在设计师中预览。
-
在同步完成后,如果需要,您可以重复第一步来切换离线模式,您的项目将已缓存您所需的模块,您将能够在没有互联网的情况下构建项目。
> 来源: https://developer.android.com/studio/releases#3.6-gradle-offline-ui
>
搜索:切换Gradle的离线模式的新位置
>
> 关于离线模式的更多信息: https://developer.android.com/studio/build/optimize-your-build#offline_mode
>
> 搜索:启用离线模式
#祝编码愉快!
英文:
You're currently using offline mode.
In order to use gradle
's offline mode, it must've been connected to the internet at least once to download the required dependencies
and cache the modules
that are going to be used in your project.
The process to disable it is very simple:
-
Click on the word
gradle
in your right side of the screen. -
A panel will appear with some information and tasks, from the top tools bar (The one below the word
gradle
in your picture) and to the very right, you'll see a button with settings (configuration) icon, to its left, there's a highlighted button with crossed-line icon, click on it to enable online mode. -
You'll need to sync your project (You will need to have access to the internet), by going to Files -> Sync Project with gradle files
-
Then Run -> Rebuild, to build the project and have the preview in your designer.
-
After the sync finishes, you can repeat the first step to toggle offline mode if you wish to, your project will have cached the modules you need and you'll be able to build your project without internet.
> Source: https://developer.android.com/studio/releases#3.6-gradle-offline-ui
>
Search for: New location to toggle Gradle's offline mode
>
> More about Offline-Mode: https://developer.android.com/studio/build/optimize-your-build#offline_mode
>
> Search for: Enable offline mode
#Happy coding!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论