blackkara
blackkara

Reputation: 5052

How To Deal With 'Cannot Find Getter For Field' Errors?

I just pulled my previously android projects but now both giving this cannot find getter for field error.

Such as InstagramSharing.kt

@Entity
data class InstagramSharing(
    @PrimaryKey var instagramSharingId: String,
    ...
)

And when build(InstagramSharing.java)

@androidx.room.Entity()
@kotlin.Metadata(...)
public final class InstagramSharing {
    @org.jetbrains.annotations.NotNull()
    @androidx.room.PrimaryKey()
    private java.lang.String instagramSharingId;

    @org.jetbrains.annotations.NotNull()
    public final java.lang.String getInstagramSharingId() {
        return null;
    }

    public final void setInstagramSharingId(@org.jetbrains.annotations.NotNull()
    java.lang.String p0) {
    }
}

But interestingly outputs error: Cannot find getter for field. private java.lang.String instagramSharingId;

Is there anyway to overcome this weirdo problem?


EDIT

After deeply analyzing, appeared that I-i characters causing this error. E.g in below model, while progress and selected fields not causing errors, instagramItemId, instagramSharingId fields caused.

@Entity
data class InstagramItemProgress(
    @PrimaryKey
    var instagramItemId: String,
    var instagramSharingId: String,
    var progress: String,
    var selected: Boolean
)

error: Cannot find getter for field. private java.lang.String instagramItemId;

error: Cannot find getter for field. private java.lang.String instagramSharingId;

Upvotes: 1

Views: 224

Answers (1)

blackkara
blackkara

Reputation: 5052

My machine language was Turkish. I can't believe this, but changing the language to English solved the problem.

Note: I never want to misguide ones having same problem. In my case that's OK

Upvotes: 1

Related Questions