Я получаю эту ошибку в этом фрагменте кода. You must annotate primary keys with @NonNull. "uidString" is nullable.
Когда я комментирую его с помощью @NonNull и @PrimaryKey, An entity must have at least 1 field annotated with @PrimaryKey
Как дела?
import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
import java.util.UUID;
@Entity(tableName = "player_profiles")
public class PlayerGameProfile implements Parcelable {
@PrimaryKey
public String uidString = UUID.randomUUID().toString();
@ColumnInfo(name = "name")
public String name;
When I annotate it with @NonNull, An entity must have at least 1 field annotated with @PrimaryKey
Вы аннотировали его оба или только@NonNull
? - person tkausl   schedule 13.11.2019import android.support.annotation.NonNull;
- person Tiberiu Zulean   schedule 13.11.2019implementation 'androidx.room:room-runtime:2.2.1'
иannotationProcessor 'androidx.room:room-compiler:2.2.1'
. Я столкнулся с тем, что, похоже, было той же проблемой с более ранними библиотеками. - person MikeT   schedule 13.11.2019