Visual Studio代码应用中心:Android Gradle插件需要Java 11才能运行。您目前正在使用Java 1.8

发布于 2025-01-21 20:41:06 字数 1494 浏览 0 评论 0 原文

我使用Visual Studio Code App Center来构建我的Android应用程序,此后还可以,但是现在构建失败了,以下异常。如何解决此问题?

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/runner/work/1/s/app/build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
   > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
     You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 45s
Error: /Users/runner/work/1/s/gradlew failed with return code: 1
    at ChildProcess.<anonymous> (/Users/runner/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/1.128.0/node_modules/vsts-task-lib/toolrunner.js:569:30)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:920:16)
    at Socket.<anonymous> (internal/child_process.js:351:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:509:12)
##[error]Error: /Users/runner/work/1/s/gradlew failed with return code: 1

I used Visual Studio Code App Center for Building my android apps, It was ok after but now build failed with below exception. How can I fix this issue?

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/runner/work/1/s/app/build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
   > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
     You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 45s
Error: /Users/runner/work/1/s/gradlew failed with return code: 1
    at ChildProcess.<anonymous> (/Users/runner/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/1.128.0/node_modules/vsts-task-lib/toolrunner.js:569:30)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:920:16)
    at Socket.<anonymous> (internal/child_process.js:351:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:509:12)
##[error]Error: /Users/runner/work/1/s/gradlew failed with return code: 1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

画▽骨i 2025-01-28 20:41:06

如果您使用的是 Visual Studio Code App Center ,则在您的Android项目中使用Java 11时可能会遇到相同的问题。如果您正在寻找MS App Center问题的解决方案,这可能会对您有所帮助!

  1. 转到
  2. 单击“设置”图标,转到构建配置
  3. 滚动到 emovention 并打开。
  4. set java_home to $(java_home_11_x64)

If you are using Visual Studio Code App Center, you may face the same kind of issue when you use JAVA 11 in your android project. If you are looking a solution for MS App Center issue, This may help you!

  1. Go to https://appcenter.ms/users/user1/apps/yourapp/build/branches
  2. Click settings icon to go to Build configuration
  3. Scroll down to Environment and turn on.
  4. Set JAVA_HOME to $(JAVA_HOME_11_X64)

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文