Summary
Gradle Sync fails on Machines with Apple M1 Chipset when Flowbius dependency is added to the kotlin library module of my project. The project runs fine on Intel machines though.
Dependency
implementation 'com.trello.flowbius:flowbius:0.1.0'
Description
I'm trying to add flowbius to a kotlin library module of my project and I get the following error when I try to run the project on M1 machines:
Execution failed for task ':core:compileKotlin'.
> Error while evaluating property 'filteredArgumentsMap' of task ':core:compileKotlin'
> Could not resolve all files for configuration ':core:compileClasspath'.
> Could not resolve com.trello.flowbius:flowbius:0.1.0.
Required by:
project :core
> No matching variant of com.trello.flowbius:flowbius:0.1.0 was found. The consumer was configured to find an API of a library compatible with Java 11, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
- Variant 'apiElements' capability com.trello.flowbius:flowbius:0.1.0 declares an API of a library, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
- Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'runtimeElements' capability com.trello.flowbius:flowbius:0.1.0 declares a runtime of a library, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
- Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
This issue does not occur on Mac with Intel Chip. It is however resolved for M1 Chip Machine as well if I change my module's targetCompatibility to JavaVersion.VERSION_17
or when I change this module to to an android library.
Project Configuration
Gradle file of module in which I'm trying to add Flowbius:
plugins {
id 'org.jetbrains.kotlin.jvm'
}
dependencies {
api "com.spotify.mobius:mobius-core:1.5.9"
implementation 'com.trello.flowbius:flowbius:0.1.0'
testImplementation "com.spotify.mobius:mobius-test:1.5.9"
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.8.2"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.8.2"
testImplementation "com.google.truth:truth:1.1.3"
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
test {
useJUnitPlatform()
}
Project's Root Gradle
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
id 'org.jetbrains.kotlin.jvm' version '1.7.10' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Environment
Laptop:
M1 Pro chip MBP with Mac OS Monterey 12.6.
Android Studio:
Android Studio Dolphin | 2021.3.1
java --version:
openjdk 11.0.15 2022-04-19 LTS
OpenJDK Runtime Environment Zulu11.56+19-CA (build 11.0.15+10-LTS)
OpenJDK 64-Bit Server VM Zulu11.56+19-CA (build 11.0.15+10-LTS, mixed mode)