I have a fresh project with 2 modules: "app" and "shared"
When I changed the
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
from 1_7 to 1_8 (im not sure this change caused it)
I cannot build my project successfully. I have multiple lines of errors (below its just one)
Execution failed for task ':shared:compileKotlin'.
> Could not resolve all files for configuration ':shared:compileClasspath'.
> Could not resolve androidx.activity:activity:1.2.2.
Required by:
project :shared > com.google.dagger:hilt-android:2.39.1
> No matching variant of androidx.activity:activity:1.2.2 was found. The consumer was configured to find an API of a library compatible with Java 8, preferably in the form of class files, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
- Variant 'releaseApiPublication' capability androidx.activity:activity:1.2.2 declares an API of a library, and its dependencies declared externally:
- Incompatible because this component declares a component, with the library elements 'aar' and the consumer needed a component, preferably in the form of class files
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
I have Gradle version 6.5 and Android plugin version 4.1.3
this is my shared build.gradle file
plugins {
id 'java-library'
id 'kotlin'
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0"
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.google.dagger:hilt-android:2.39.1'
annotationProcessor 'com.google.dagger:hilt-android-compiler:2.35'
implementation 'com.squareup.moshi:moshi:1.8.0'
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.squareup.okhttp3:okhttp:4.9.1"
implementation "com.squareup.okhttp3:okhttp-urlconnection:4.9.1"
implementation "com.squareup.okhttp3:logging-interceptor:4.9.1"
implementation "com.google.code.gson:gson:2.8.9"
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:29.0.4')
// When using the BoM, you don't specify versions in Firebase library dependencies
// Declare the dependency for the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-analytics-ktx'
// Declare the dependencies for any other desired Firebase products
// For example, declare the dependencies for Firebase Authentication and Cloud Firestore
implementation 'com.google.firebase:firebase-auth-ktx'
implementation 'com.google.firebase:firebase-firestore-ktx'
}
i also get this message in project settings
CodePudding user response: