我对 AppCenter Build 的行为感到非常困惑。我成功创建了 GitHub Action 来构建 Android 项目,但是当我将 AppCenter 指向该存储库时,我得到以下信息:
Project AndroidDummy1 at : is either no Android app project or build version has not been set to override. Skipping...
...其中“AndroidDummy1”是我正在使用的测试项目,一个非常简单的单屏应用程序,仅用于调试和测试 AppCenter 构建过程。更多日志如下所示:
Welcome to Gradle 8.2!
Here are the highlights of this release:
- Kotlin DSL: new reference documentation, assignment syntax by default
- Kotlin DSL is now the default with Gradle init
- Improved suggestions to resolve errors in console output
For more details see https://docs.gradle.org/8.2/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
Gradle 8.2
> Configure project :
Resolved com.android.application:com.android.application.gradle.plugin:8.2.0 in detachedConfiguration1
Resolved org.jetbrains.kotlin.android:org.jetbrains.kotlin.android.gradle.plugin:1.9.0 in detachedConfiguration2
Resolved com.android.application:com.android.application.gradle.plugin:8.2.0 in :classpath
Resolved org.jetbrains.kotlin.android:org.jetbrains.kotlin.android.gradle.plugin:1.9.0 in :classpath
Project AndroidDummy1 at : is either no Android app project or build version has not been set to override. Skipping...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'AndroidDummy1'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:8.2.0.
Required by:
project : > com.android.application:com.android.application.gradle.plugin:8.2.0
> No matching variant of com.android.tools.build:gradle:8.2.0 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.2' but:
- Variant 'apiElements' capability com.android.tools.build:gradle:8.2.0 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component for use during compile-time, compatible with Java 11 and the consumer needed a component for use during runtime, compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.2')
- Variant 'javadocElements' capability com.android.tools.build:gradle:8.2.0 declares a component for use during runtime, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '8.2')
- Variant 'runtimeElements' capability com.android.tools.build:gradle:8.2.0 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component, compatible with Java 11 and the consumer needed a component, compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.2')
- Variant 'sourcesElements' capability com.android.tools.build:gradle:8.2.0 declares a component for use during runtime, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '8.2')
* 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 21s
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
##[section]Finishing: Gradle Task
我试图找到我认为 AppCenter 生成的 YAML,但我最接近看到 AppCenter 触发的内容是当我查看配置选项,打开“导出分支配置”窗口,并查看“YAML”时导出配置”部分。我看到了 AppCenter 使用的所有步骤,但似乎这是一种单向显示 - 我无法更改该脚本来调整以找到可行的解决方案。在其上方的“高级构建配置”部分中,它这样说:
“Azure Pipeline 支持比 App Center Build 更高级的构建配置。如果您的应用程序具有复杂的存储库结构或需要使用 App Center 不支持的框架进行自定义,请尝试设置可以更好地为您的应用程序服务的 Azure Pipelines。”
然后它会持续一段时间。
这是否意味着我必须迁移到 Azure Pipelines 才能成功启动 AppCenter 构建?我不明白为什么错误消息中明显有一个空引用(在冒号处):“Project AndroidDummy1 at : is”
我在这里缺少什么?
根据文档“Building Java apps for Android”和“JCenter shutdown后构建Gradle”中的说法,最近关闭JCenter可能会导致类似的Gradle任务失败。
如果您在 AppCenter Android 构建中使用 JCenter 和 Bintray 资源,构建中的 Gradle 任务失败可能与此相关。