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

1.3K
Views
¿Cómo arreglar el LifecycleScope de referencia no resuelto?

Intentando construir un ejemplo simple que use corrutinas kotlin en una actividad:

 lifecycleScope.launch { val result = httpGet("http://hmkcode-api.appspot.com/rest/api/hello/Android") textView.setText(result) }

No puedo deshacerme del error "LifecycleScope de referencia sin resolver"

Parte relevante del archivo gradle:

 apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' dependencies { implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2' implementation "org.jetbrains.kotlinx:kotlinx-coroutines-rx2:1.3.2" def androidArchVersion = '1.1.1' implementation "android.arch.lifecycle:viewmodel:$androidArchVersion" implementation "android.arch.lifecycle:livedata:$androidArchVersion" annotationProcessor "android.arch.lifecycle:compiler:$androidArchVersion" testImplementation "android.arch.core:core-testing:$androidArchVersion" implementation "android.arch.lifecycle:extensions:$androidArchVersion" } kotlinOptions { jvmTarget = '1.8' apiVersion = '1.3' languageVersion = '1.3' }

}

over 4 years ago · Hanz Gallego
2 answers
Answer question

0

Según la documentación de Lifecycle KTX , debe incluir el artefacto lifecycle-runtime-ktx si desea extensiones específicas de Coroutine.

Tenga en cuenta que lifecycle-runtime-ktx solo se introdujo en Lifecycle 2.2.0 , por lo que deberá migrar a AndroidX y luego actualizar a Lifecycle 2.2.0 si desea usar esa funcionalidad.

over 4 years ago · Hanz Gallego Report

0

Respuesta tardía aquí, pero también enfrenté este problema y finalmente logré resolverlo cambiando la Activity de Android heredada a AppCompatActivity .

over 4 years ago · Hanz Gallego 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!