Closed abdulgaffar291 closed 8 years ago
Well, what's the NewCustomer
class?
Its the realm model class which extends RealmObject.
@abdulgaffar291 Is it the full log? It supposed to have the problematic class name following error: A RealmClass annotated object must implement RealmModel or derive from RealmObject
.
And also, are you using kotlin? Can you share the source code of the problematic class definition?
package com.realm;
import io.realm.RealmObject;
import io.realm.annotations.Required;
public class NewCustomer extends RealmObject {
@Required
private String name;
private String cardNumber;
private String mobileNumber;
private String emailId;
public void setName(String name){
this.name = name;
}
public String getName(){
return this.name;
}
public void setCardNumber(String cardNumber){
this.cardNumber = cardNumber;
}
public String getCardNumber(){
return this.cardNumber;
}
public void setMobileNumber(String mobileNumber){
this.mobileNumber = mobileNumber;
}
public String getMobileNumber(){
return this.mobileNumber;
}
public void setEmailId(String email){
this.emailId = email;
}
public String getEmailId(){
return this.emailId;
}
}
@beeender No, i ain't using kotlin.
what is your android gradle plugin version? something in the root build.gradle Some thing like
classpath 'com.android.tools.build:gradle:2.1.0'
Yeah. absolutely @beeender
So, what would be the problem with gradle version 2.1.0
Then i have no idea why you have this problem ... Do you use instant run? Maybe try to clean the project and build again? If those doesn't solve the problem, you can share your project with us, we could have a look. send it to help@realm.io or any other way you want.
Ok i'll try to clean & rebuild it.
I've removed unwanted api's and i cleaned & rebuild it. then it got fixed
Great!
I'm getting same error in logcat by using annotation.
@Parcel
@RealmClass
public class PointOfInterest {
public static final int TYPE_NONE = 0;
public static final int TYPE_RECENT = 1;
public static final int TYPE_FAVORITE = 2;
@PrimaryKey
String uid;
String poiServiceUuid;
String address;
.
.
.
I cleaned and rebuilt project several times but I'm still getting same error message. However by removing that annotation and extending RealmObject, problem fixed. I thought annotation does the same thing extend does. I have no problem in my test project by using annotation but seems something is wrong in this project.
You also need to implements RealmModel
pr https://realm.io/docs/java/latest/#realmmodel-interface
Version of Realm and tooling
Realm version(s): 1.0.0
Android Studio version: 2.1
Which Android version and device: Nexus 5