Не удалось выполнить задачу ':shared:compileDebugKotlinAndroid' .
Обнаружена несогласованная совместимость с целевой JVM для задач «compileDebugJavaWithJavac» (1.8) и «compileDebugKotlinAndroid» (17).
< /blockquote>
Я изменил это
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
kotlinOptions {
jvmTarget = "1.8"
}
в
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
kotlinOptions {
jvmTarget = "17"
}
Но это не работает.
Я потратил на это дней, может кто-нибудь чем-нибудь помочь , пожалуйста? Я больше понятия не имею, где искать.
Вот ВСЕ файлы build.gradles в приложении
Уровень приложения
import groovy.json.JsonBuilder
ext.versionMajor = Integer.valueOf(System.env.MAJOR_NUMBER ?: 3)
ext.versionMinor = Integer.valueOf(System.env.MINOR_NUMBER ?: 1)
ext.versionMinorSec = Integer.valueOf(System.env.MINOR_NUMBER_SEC ?: 0)
ext.jenkinsBuild = Integer.valueOf(getBuildNumberOverride() ?: System.env.BUILD_NUMBER ?: 1000)
ext.login = getCredentials("login")
ext.password = getCredentials("password")
def computeVersionName() {
return String.format('%d.%d.%d.%d', versionMajor, versionMinor, versionMinorSec, jenkinsBuild)
}
def computeVersionCode() {
final VERSION_BASE = 10000
final MAX_VERSION_PIECE = 100
if (versionMajor >= MAX_VERSION_PIECE) {
throw new IllegalArgumentException(
"'versionMajor' cannot be greater than " + (MAX_VERSION_PIECE-1))
}
if (versionMinor >= MAX_VERSION_PIECE) {
throw new IllegalArgumentException(
"'versionMinor' cannot be greater than " + (MAX_VERSION_PIECE-1))
}
if (versionMinorSec >= MAX_VERSION_PIECE) {
throw new IllegalArgumentException(
"'versionMinorSec' cannot be greater than " + (MAX_VERSION_PIECE-1))
}
if (jenkinsBuild >= VERSION_BASE) {
throw new IllegalArgumentException(
"'jenkinsBuild' cannot be greater than " + (VERSION_BASE-1))
}
return ((versionMajor * VERSION_BASE * MAX_VERSION_PIECE * MAX_VERSION_PIECE)
+ (versionMinor * VERSION_BASE * MAX_VERSION_PIECE)
+ (versionMinorSec * VERSION_BASE)
+ jenkinsBuild)
}
def evaluateAndroidTestBuildType() {
return rootProject.hasProperty("androidTestsBuildType")
? rootProject.property("androidTestsBuildType")
: "debug"
}
def getBuildNumberOverride() {
return rootProject.hasProperty("overrideBuildNumber")
? rootProject.property("overrideBuildNumber")
: null
}
def getCredentials(String type) {
return rootProject.hasProperty(type)
? rootProject.property(type)
: null
}
def generateCredentialsJSON() {
def json = new JsonBuilder()
def root = json.email_subscribed {
}
def file = new File("app/build/generated/androidTest/.json")
if (!file.exists()) {
file.getParentFile().mkdirs()
file.createNewFile()
}
file.write(json.toPrettyString())
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.devtools.ksp'
android {
signingConfigs {
release {
}
}
defaultConfig {
minSdkVersion 21
compileSdk 34
targetSdkVersion 34
applicationId "com.WisdomEdition"
versionCode computeVersionCode()
versionName computeVersionName()
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments clearPackageData: 'true'
testBuildType evaluateAndroidTestBuildType()
multiDexEnabled true
buildConfigField "String", "COLIBRIO_LICENSE_API_KEY", System.getenv("COLIBRIO_LICENSE_API_KEY") ?: localProperty("COLIBRIO_LICENSE_API_KEY")
buildConfigField "String", 'COLIBRIO_LICENSE_API_SECRET', System.getenv("COLIBRIO_LICENSE_API_SECRET") ?: localProperty("COLIBRIO_LICENSE_API_SECRET")
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
signingConfig signingConfigs.release
resValue "string", "app_name", "Picka"
}
debug {
debuggable true
signingConfig signingConfigs.release
resValue "string", "app_name", "Picka"
}
qa {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
signingConfig signingConfigs.release
resValue "string", "app_name", "PickaQA"
}
qaDebug{
debuggable true
signingConfig signingConfigs.release
resValue "string", "app_name", "PickaQA"
}
instrumentationRelease {
initWith release
proguardFiles 'proguard-test-rules.pro'
resValue "string", "app_name", "Picka"
}
}
flavorDimensions 'tier'
productFlavors {
combined {
dimension 'tier'
}
babyfirst {
dimension 'tier'
}
huawei {
dimension 'tier'
}
}
applicationVariants.all { variant ->
variant.outputs.all { output ->
def flavor = "-" + variant.productFlavors[0].name
def buildType = "-" + variant.buildType.name
def version = "-" + versionMajor + "." + versionMinor + "." + versionMinorSec + "." + jenkinsBuild
outputFileName = new File("picka" + f l a v o r + b u i l d T y p e + v e r s i o n + & q u o t ; . a p k & q u o t ; ) < b r / > } < b r / > } < b r / > c o m p i l e O p t i o n s { < b r / > c o r e L i b r a r y D e s u g a r i n g E n a b l e d t r u e < b r / > s o u r c e C o m p a t i b i l i t y J a v a V e r s i o n . V E R S I O N _ 1 _ 8 < b r / > t a r g e t C o m p a t i b i l i t y J a v a V e r s i o n . V E R S I O N _ 1 _ 8 < b r / > } < b r / > k o t l i n O p t i o n s { < b r / > j v m T a r g e t = & q u o t ; 1 . 8 & q u o t ; < b r / > } < b r / > b u i l d F e a t u r e s { < b r / > v i e w B i n d i n g = t r u e < b r / > d a t a B i n d i n g = t r u e < b r / > c o m p o s e = t r u e < b r / > } < b r / > c o m p o s e O p t i o n s { < b r / > / / C o m p a t i b i l i t y w i t h k o t l i n _ v e r s i o n h t t p s : / / d e v e l o p e r . a n d r o i d . c o m / j e t p a c k / a n d r o i d x / r e l e a s e s / c o m p o s e - k o t l i n < b r / > k o t l i n C o m p i l e r E x t e n s i o n V e r s i o n = & q u o t ; 1 . 5 . 1 0 & q u o t ; < b r / > } < b r / > s o u r c e S e t s { < b r / > a n d r o i d T e s t { < b r / > a s s e t s { < b r / > s r c D i r s ' b u i l d / g e n e r a t e d / a n d r o i d T e s t ' < b r / > } < b r / > } < b r / > } < b r / > t e s t O p t i o n s { < b r / > e x e c u t i o n ' A N D R O I D X _ T E S T _ O R C H E S T R A T O R ' < b r / > } < b r / > n a m e s p a c e ' c o m . p i c k a . b o o k s h e l f ' < b r / > l i n t { < b r / > a b o r t O n E r r o r f a l s e < b r / > c h e c k R e l e a s e B u i l d s f a l s e < b r / > } < b r / > } < b r / > < b r / > d e p e n d e n c i e s { < b r / > i m p l e m e n t a t i o n p r o j e c t ( ' : s h a r e d ' ) < b r / > c o r e L i b r a r y D e s u g a r i n g ' c o m . a n d r o i d . t o o l s : d e s u g a r _ j d k _ l i b s : 1 . 1 . 5 ' < b r / > i m p l e m e n t a t i o n ' a n d r o i d x . a p p c o m p a t :appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.fragment:fragment-ktx:1.3.6'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0'
implementation 'androidx.media:media:1.6.0'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.room:room-runtime:2.4.2'
ksp "androidx.room:room-compiler:2.4.2"
implementation 'androidx.room:room-rxjava2:2.4.2'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'com.airbnb.android:lottie:6.1.0'
implementation 'com.airbnb.android:lottie-compose:6.1.0'
implementation 'com.android.billingclient:billing:7.0.0'
implementation 'com.android.installreferrer:installreferrer:1.1.2' // required by adjust
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'com.google.android.exoplayer:exoplayer-core:2.15.1'
implementation 'com.google.android.flexbox:flexbox:3.0.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.firebase:firebase-config:19.2.0'
implementation 'com.google.firebase:firebase-crashlytics:18.3.5'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
implementation 'io.github.esentsov:kotlin-visibility:1.1.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:3.2.0'
testImplementation 'org.mockito:mockito-inline:3.2.0'
testImplementation 'org.robolectric:robolectric:4.3.1'
androidTestImplementation 'androidx.core:core-ktx:1.6.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
androidTestImplementation 'androidx.test
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestUtil 'androidx.test:orchestrator:1.2.0'
implementation "io.branch.sdk.android:library:5.2.0"
implementation 'com.colibrio:reader-framework:3.7.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0'
implementation 'com.rudderstack.android.sdk:core:1.23.2'
implementation 'com.github.Kaaveh:sdp-compose:1.1.0'
implementation 'io.coil-kt:coil-compose:2.5.0'
def composeBom = platform('androidx.compose:compose-bom:2024.05.00')
implementation composeBom
androidTestImplementation composeBom
implementation 'androidx.compose.material3:material3'
// implementation 'androidx.compose.material:material'
// // or skip Material Design and build directly on top of foundational components
implementation 'androidx.compose.foundation:foundation-layout'
// // or only import the main APIs for the underlying toolkit systems,
implementation 'androidx.compose.ui:ui'
// Android Studio Preview support
implementation 'androidx.compose.ui:ui-tooling-preview'
debugImplementation 'androidx.compose.ui:ui-tooling'
// UI Tests
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
// View models
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose'
//Pull to refresh
implementation "androidx.compose.material:material"
implementation 'com.transifex.txnative:txsdk:1.2.1'
}
tasks.register('generateUITestsCredentials').configure {
doFirst {
generateCredentialsJSON()
}
}
afterEvaluate {
tasks.forEach {
if (it.name.matches('^process(.+)AndroidTestResources$')) {
it.dependsOn.add(tasks.getByName("generateUITestsCredentials"))
}
}
}
Object localProperty(String propertyName) {
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def propertyValue = localProperties[propertyName]
return propertyValue != null ? propertyValue : ''
}
Уровень проекта
plugins {
kotlin("multiplatform") version "1.9.22" apply false
//Check ksp compatibility with kotlin_version here: https://github.com/google/ksp/releases
id("com.google.devtools.ksp") version "1.9.22-1.0.17" apply false
}
buildscript {
val kotlin_version by extra("1.9.20")
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
dependencies {
classpath("com.android.tools.build:gradle:8.0.0")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.4")
classpath("com.google.gms:google-services:4.3.15")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
maven {
url = uri(
// System.getenv("COLIBRIO_MAVEN_URL")
// ?: getLocalProperty("COLIBRIO_MAVEN_URL")
"https://maven.pkg.colibrio.com"
)
credentials {
// username = System.getenv("COLIBRIO_MAVEN_USERNAME")
// ?: getLocalProperty("COLIBRIO_MAVEN_USERNAME") as String
username = ""
// password = System.getenv("COLIBRIO_MAVEN_PASSWORD")
// ?: getLocalProperty("COLIBRIO_MAVEN_PASSWORD") as String
password = ""
}
}
}
}
tasks.withType {
distributionType = Wrapper.DistributionType.ALL
}
fun getLocalProperty(key: String): Any {
val properties = java.util.Properties()
val projectRootDir = project.rootDir.absolutePath
val localProperties = File(projectRootDir, "local.properties")
if (localProperties.isFile) {
java.io.InputStreamReader(java.io.FileInputStream(localProperties), Charsets.UTF_8).use { reader ->
properties.load(reader)
}
} else error("File from not found $localProperties")
return properties.getProperty(key)
}
Я также использую KMM, вот build.gradle для общего модуля на случай, если это поможет
plugins {
kotlin("multiplatform")
id("com.android.library")
id("co.touchlab.faktory.kmmbridge") version "0.3.7"
id("com.apollographql.apollo3") version "3.7.4"
id("io.github.luca992.multiplatform-swiftpackage") version "2.1.1"
`maven-publish`
id("kotlin-parcelize")
id("app.cash.sqldelight") version "2.0.0-alpha05"
id("com.google.devtools.ksp")
id("com.rickclephas.kmp.nativecoroutines") version "1.0.0-ALPHA-25"
kotlin("plugin.serialization") version "1.4.21"
}
version = "0.0.1"
sqldelight {
databases {
create("SharedDatabase") {
packageName.set("com.picka.shared.db")
}
version = 2
}
}
kotlin {
multiplatformSwiftPackage {
packageName("PickaBusinessLayer")
swiftToolsVersion("5.3")
targetPlatforms {
iOS { v("15") }
}
outputDirectory(File(rootDir, "/"))
}
android()
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach {
it.binaries.framework {
baseName = "shared"
isStatic = true
}
}
val reaktiveVersion = "1.2.3"
val ktorVersion = "2.3.5"
val okioVersion = "3.6.0"
sourceSets {
all {
languageSettings.optIn("kotlinx.cinterop.ExperimentalForeignApi")
//This was added for rickclephas' nativeCoroutines support alongside ksp
languageSettings.optIn("kotlin.experimental.ExperimentalObjCName")
}
val commonMain by getting {
dependencies {
api("com.apollographql.apollo3:apollo-runtime:3.7.4")
api("com.badoo.reaktive:reaktive:$reaktiveVersion")
api("com.badoo.reaktive:coroutines-interop:$reaktiveVersion")
implementation("com.russhwolf:multiplatform-settings-no-arg:1.0.0")
implementation("co.touchlab:stately-concurrency:1.2.5")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
implementation("app.cash.sqldelight:primitive-adapters:2.0.0-alpha05")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0")
api("io.ktor:ktor-client-core:$ktorVersion")
api("io.ktor:ktor-client-logging:$ktorVersion")
api("io.ktor:ktor-client-content-negotiation:$ktorVersion")
api("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
implementation("com.squareup.okio:okio:$okioVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
api("com.rickclephas.kmm:kmm-viewmodel-core:1.0.0-ALPHA-19")
}
}
val androidMain by getting {
dependencies {
implementation("app.cash.sqldelight:android-driver:2.0.0-alpha05")
implementation("io.ktor:ktor-client-okhttp:$ktorVersion")
}
}
val commonTest by getting
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
dependencies {
implementation("com.rickclephas.kmp:nsexception-kt-crashlytics:0.1.7")
implementation("app.cash.sqldelight:native-driver:2.0.0-alpha05")
implementation("io.ktor:ktor-client-darwin:$ktorVersion")
}
}
val iosX64Test by getting
val iosArm64Test by getting
val iosSimulatorArm64Test by getting
val iosTest by creating {
dependsOn(commonTest)
iosX64Test.dependsOn(this)
iosArm64Test.dependsOn(this)
iosSimulatorArm64Test.dependsOn(this)
}
}
//Export Kdoc
targets.withType {
compilations.get("main").kotlinOptions.freeCompilerArgs += "-Xexport-kdoc"
}
}
android {
compileSdk = 34
defaultConfig {
minSdk = 21
targetSdk = 34
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
namespace = "com.picka.shared"
}
apollo {
generateKotlinModels.set(true)
service("service") {
packageName.set("com.picka.shared")
generateAsInternal.set(true)
}
}
addGithubPackagesRepository()
kmmbridge {
mavenPublishArtifacts()
githubReleaseVersions()
versionPrefix.set("0.8")
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... p-to-8-0-0
Мобильная версия