A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution

前端 未结 30 1796
南旧
南旧 2020-12-12 20:01

All of sudden I start getting this error, and I am not getting idea why if anyone just let me know where this error is, will be enough helpful. As much I am able to get is t

相关标签:
30条回答
  • 2020-12-12 20:43

    I was also encountered with the same problem so for just try I deleted it project's .idea folder and .gradle folder then i also deleted build folder inside app folder and then restart android studio IDE and it works for me

    0 讨论(0)
  • 2020-12-12 20:44

    I just updated Android Studio IDE to 4.1.1 version and got a similar issue.

    What I realised was…

    … before I did not had some *_Impl classes (I know about them in Kotlin stuff) and not even some new *Tests classes.

    So, after “run all the World” to take a solution, I just made an intuitive and fair choice: I deleted all those files inside my "hand builded" packages that was not there before Android Studio update.

    And, guess what?

    It worked. No issues, not even one problem about kapt.

    I’m not saying that it is a final solution. But it can work for you.

    Have a good one.

    0 讨论(0)
  • 2020-12-12 20:45

    Shout Out to @Rene Spies' answer above, I also got this error while working with databinding. It turns out the build engine doesn't like it when you put the @Bindable annotation on a field in the primary constructor of a data class in Kotlin.

    So never do the following,

    data class MyAwesomePojo(
        @Bindable
        var firstname: String,
        var lastname: String
    )
    

    instead what you need to do is

    data class MyCorrectAwesomePojo(
        var lastname: String
    ):{
        @get:Bindable
        var firstname: String
            set(value){
                field = value
            }
    }
    

    Bonus: remember to check for same values before setting value to field if you are trying to use two-way binding like me to prevent infinite looping of setting and getting.

    0 讨论(0)
  • 2020-12-12 20:46

    I had same problem with Room and i was not using viewBinding.
    I Fixed it with using exportSchema to false in my database class.

    @Database(entities = [ModelClass::class], version = 1, exportSchema = false)
    abstract class ModelDatabase: RoomDatabase() {}
    

    Remember: exportScehma could be vary according to your use case, generally it stays false so i put it to false.

    0 讨论(0)
  • 2020-12-12 20:47

    Yup, I also got this error and it was also a Room related issue.

    I had defined my TypeConverters, but never annotated my Room database with: @TypeConverters(TypeConverter.class).

    0 讨论(0)
  • 2020-12-12 20:48

    try to build your project with

    kapt.use.worker.api=false 
    

    in your gradle.properties settings file

    Reference: https://youtrack.jetbrains.com/issue/KT-40750

    0 讨论(0)
提交回复
热议问题