gradle构建在Android Studio上失败:com.android.application在任何版本中都找不到

huangapple go评论72阅读模式
英文:

gradle build fails on Android Studio : com.android.application cannot be found for any version

问题

When I do gradle build it gets stuck on this for a while:

执行gradle构建时,它会在这一步停滞一段时间:

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
启动Gradle守护进程,1个不兼容的守护进程无法重用,请使用--status查看详细信息
<-------------> 0% CONFIGURING [21s]
<-------------> 0% 正在配置 [21秒]
> root project > Resolve dependencies of detachedConfiguration1 > com.android.application.gradle.plugin-8.0.1.pom
> 根项目 > 解决detachedConfiguration1的依赖关系 > com.android.application.gradle.plugin-8.0.1.pom

and then it fails reporting:

然后它报告失败:

  • What went wrong:
  • 出了什么问题:
    Plugin [id: 'com.android.application', version: '8.0.1', apply: false] was not found in any of the following sources:
    插件[id:'com.android.application',版本:'8.0.1',apply:false]未在以下任何来源中找到:
  • Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
  • Gradle核心插件(插件不在'org.gradle'命名空间中)
  • Plugin Repositories (could not resolve plugin artifact 'com.android.application:com.android.application.gradle.plugin:8.0.1')
    插件仓库(无法解决插件artifact 'com.android.application:com.android.application.gradle.plugin:8.0.1')
    Searched in the following repositories:
    在以下仓库中搜索:
    Google
    MavenRepo
    Gradle Central Plugin Repository

I do can access from browser to https://mvnrepository.com/artifact/com.android.application/com.android.application.gradle.plugin/8.0.1 but I have noticed that even though I have no proxy enabled on my Android Studio, maven repository gives 403 if I check connection against it:

我可以从浏览器访问https://mvnrepository.com/artifact/com.android.application/com.android.application.gradle.plugin/8.0.1,但我注意到即使我在Android Studio上没有启用代理,maven仓库在我检查连接时返回403:

gradle构建在Android Studio上失败:com.android.application在任何版本中都找不到

gradle构建在Android Studio上失败:com.android.application在任何版本中都找不到

Any version of com.android.application would return the same error.

任何版本的com.android.application都会返回相同的错误。

I'm using Gradle 8.1.1, JDK 17, and Android Studio Hedgehog | 2023.1.1 Canary 3. Any help?

我正在使用Gradle 8.1.1,JDK 17和Android Studio Hedgehog | 2023.1.1 Canary 3。有什么帮助吗?

英文:

When I do gradle build it gets stuck on this for a while:

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
&lt;-------------&gt; 0% CONFIGURING [21s]
&gt; root project &gt; Resolve dependencies of detachedConfiguration1 &gt; com.android.application.gradle.plugin-8.0.1.pom

and then it fails reporting:

* What went wrong:
Plugin [id: &#39;com.android.application&#39;, version: &#39;8.0.1&#39;, apply: false] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in &#39;org.gradle&#39; namespace)
- Plugin Repositories (could not resolve plugin artifact &#39;com.android.application:com.android.application.gradle.plugin:8.0.1&#39;)
  Searched in the following repositories:
    Google
    MavenRepo
    Gradle Central Plugin Repository

I do can access from browser to https://mvnrepository.com/artifact/com.android.application/com.android.application.gradle.plugin/8.0.1 but I have noticed that even though I have no proxy enabled on my Android Studio, maven repository gives 403 if I check connection against it:

gradle构建在Android Studio上失败:com.android.application在任何版本中都找不到

gradle构建在Android Studio上失败:com.android.application在任何版本中都找不到

Any version of com.android.application would return same error.
I'm using gradle 8.1.1, jdk17 and Android Studio Hedgehog | 2023.1.1 Canary 3. Any help?

答案1

得分: 0

I was having both a gradle installation and an skdman gradle installation. Basic installation had a minor version, while sdkman's was the one I needed. Evidently, there was a conflict between the two. I deleted everything from ~/.gradle dir and only used sdkman's gradle and now it works.

英文:

Solved it.
I was having both a gradle installation and an skdman gradle installation. Basic installation had a minor version, while sdkman's was the one I needed. Evidently, there was a conflict between the two. I deleted everything from ~/.gradle dir and only used sdkman's gradle and now it works.

huangapple
  • 本文由 发表于 2023年5月11日 18:32:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76226671.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定