Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

460
Visualizações
How to disable the generating of synthetic view properties by the Kotlin Android extensions plugin

The Kotlin Android Extensions plugin generates static properties for each view with an ID from my app layout files, as it is described in the documentation.

I would like to disable this feature, because we use DataBinding instead of the Kotlin synthetic view properties, and sometimes I import them by accident; also it adds extra build overhead for something we don't use.

Disabling the Android extensions plugin is not possible, because we use the Parcelize feature which is done by the same plugin.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

There is a features property in the androidExtensions DSL that allows you to provide a list of features to enable. Currently, there is only two available, parcelize and views. To disable synthetic view properties, add this to your build.gradle:

android {
   // ...
}

androidExtensions {
    features = ["parcelize"]
}

Source: https://github.com/JetBrains/kotlin/blob/6bef27e1e889b17ae84dd2ff99881727f13ac3e5/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/AndroidComponentRegistrar.kt#L57

over 4 years ago · Santiago Trujillo Relatório

0

Nowadays, android-extensions plugin is discontinued so the best solution will be to just remove this plugin by removing apply plugin: 'kotlin-android-extensions' from your build.gradle.

Instead of synthetics we should use ViewBinding or DataBinding.

As explained in the first link, if you're also using parcelizer, you just need to change android-extensions plugin to kotlin-parcelize and change the import statement import kotlinx.android.parcel.Parcelize for import kotlinx.parcelize.Parcelize wherever is needed.

More info to migrate from android-extensions to JetPack here.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda