I have a project that compiles fine when I run ANDROID_HOME=/.../Library/Android/sdk gradle clean assembleDebug
. But when I try to run the same on a github action like this…
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
I get
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.
But the DTO project does exist and as I said works locally. I checked the versions and they look to be the same…
------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------
Build time: 2022-08-05 21:17:56 UTC
Revision: d1daa0cbf1a0103000b71484e1dbfe096e095918
Kotlin: 1.6.21
Groovy: 3.0.10
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 15.0.2 (Oracle Corporation 15.0.2+7-27)
OS: Mac OS X 10.16 x86_64
------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------
Build time: 2022-08-05 21:17:56 UTC
Revision: d1daa0cbf1a0103000b71484e1dbfe096e095918
Kotlin: 1.6.21
Groovy: 3.0.10
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.16 (Eclipse Adoptium 11.0.16+8)
OS: Linux 5.15.0-1014-azure amd64
Why does it work locally but not via Github Actions?
Updates
It looks like it is because the library is setup like this…
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
}
instead of like the rest…
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}
So it finds the others but not this one. But I tried converting to an android app and I get the same issue.
2
Answers
In my case it was because my local box was OSX (not case sensitive) and the build box was Ubuntu (case sensitive). Once the name was lowercased it worked.
I think your computer doesn’t have enough space(RAM) for Build. I also faced the similar issue but it got resolved when I Increased my internal ram.