Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

505
Views
¿Cómo configurar la tarea compileJava' (11) y la tarea 'compileKotlin' (1.8) compatibilidad de destino jvm con la misma versión de Java en build.gradle.kts?

Construir.gradle.kts

 buildscript { repositories { google() mavenCentral() gradlePluginPortal() } dependencies { classpath ("com.android.tools.build:gradle:7.0.2") classpath ("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30") classpath("gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:${Versions.spotbugsGradlePluginVersion}") classpath("se.bjurr.violations:violations-gradle-plugin:${Versions.violationsVersion}") } } //android { // compileOptions { // sourceCompatibility = JavaVersion.VERSION_11 // targetCompatibility = JavaVersion.VERSION_11 // } // // kotlinOptions { // jvmTarget = JavaVersion.VERSION_11.toString() // } //} plugins { `maven-publish` `java-gradle-plugin` `kotlin-dsl` id ("io.gitlab.arturbosch.detekt") version ("1.18.1") } repositories { google() mavenCentral() gradlePluginPortal() } dependencies { compileOnly(gradleApi()) testImplementation(gradleTestKit()) testImplementation("junit:junit:${Versions.jUnitVersion}") } val generatedSources = tasks.register<GenerateVersionsFileTask>("generateSources")

ERROR: la tarea 'compileJava' (el objetivo actual es 11) y la tarea 'compileKotlin' (el objetivo actual es 1.8) la compatibilidad del objetivo jvm debe establecerse en la misma versión de Java.

Cuando elimino el comentario de Android {} Error: Errores de compilación del script:

 Line 15: android { ^ Unresolved reference: android

Gracias por su tiempo y esfuerzo :) Jitendra

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Puede configurar la versión de Java para Java con

 java { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 }

o alternativamente:

 java { toolchain.languageVersion.set(JavaLanguageVersion.of(11)) }

y para kotlin con:

 tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { kotlinOptions { jvmTarget = "11" } }

Todas las muestras están en gradle kotlin dsl.

over 4 years ago · Santiago Trujillo Report

0

La respuesta de @ Marian no me ayudó del todo.

Termino configurando lo siguiente en la aplicación build.gradle

 Android { ... compileOptions { sourceCompatibility JavaVersion.VERSION_11 targetCompatibility JavaVersion.VERSION_11 } kotlinOptions { jvmTarget=11 } ... }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!