Search code examples
javaandroiddatabaserealm

Why I am getting compile time error while using realm.executeTransactionAsync() method?


I am developing an application where I have to use realm database but whenever I am using realm.executeTransactionAsync() method it will give compile time error saying:

can not resolve method realm.executeTransactionAsync(Anonymous io.realm.Realm.Transaction)...

enter image description here


Solution

  • add this to your project gradle

    classpath "io.realm:realm-gradle-plugin:3.5.0"
    

    and delete any Realm compile at your model gradle and add

    apply plugin: 'realm-android'
    

    then execute this command

    ./gradlew clean