我有一个项目,当我运行ANDROID_HOME=/.../Library/Android/sdk gradle clean assembleDebug
时编译得很好。但是当我试图在这样的github操作上运行同样的项目时...
on:
push:
branches:
- '**'
jobs:
test:
name: Analyze Android
runs-on: ubuntu-latest
steps:
- name: Checkout App
uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Assemble
run: |
./gradlew clean assembleDebug
我得到
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :DTO.
Required by:
project :app
project :app > project :UI
project :app > project :Data
project :app > project :Domain
> No matching configuration of project :DTO was found. The consumer was configured to find a runtime of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.2.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
- None of the consumable configurations have attributes.
但是dto项目确实存在,正如我所说,它在本地工作。我检查了版本,它们看起来是一样的...
一个二个一个一个
为什么它可以在本地运行而不能通过Github Actions运行?
更新
看起来是因为库是这样设置的...
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
}
而不是像其他人一样。
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}
所以它找到了其他的,但不是这个。但是我试着转换到Android应用程序,我得到了同样的问题。
2条答案
按热度按时间ercv8c1e1#
在我的例子中,这是因为我的本地框是OSX(不区分大小写),构建框是Ubuntu(区分大小写)。一旦名称是小写的,它就能工作了。
oyt4ldly2#
我认为你的电脑没有足够的空间(内存)来构建。我也遇到过类似的问题,但它得到了解决,当我增加我的内部内存。