Closed yusufozcan closed 7 years ago
Will investigate. As a workaround you can use @Entity(generateGettersSetters = false) to disable getters/setter gen.
Cannot reproduce - can you post your includes?
Any idea what is different for the 2 working classes vs. the 4 defunct ones?
@Entity(generateGettersSetters = false)
not solved.
I thinked that the problem because of Scheme changing but I am not sure.
@Entity(generateGettersSetters = false)
: false is default here as Android Studio said. but it generates always.
By the way, this problem only with id property.
This is one of my working fine classes.
@Entity
public class Lemma {
@Id(assignable = true)
@SerializedName("lemma_id")
@Expose
private Long lemma_id;
@SerializedName("lemma_kelime")
@Expose
private String lemma_kelime;
@SerializedName("lemma_vocalized")
@Expose
private String lemma_vocalized;
@SerializedName("lemma_kok")
@Expose
private String lemma_kok;
@SerializedName("lemma_anlam")
@Expose
private String lemma_anlam;
@SerializedName("lemma_yapildi")
@Expose
private String lemma_yapildi;
@SerializedName("lemma_tur")
@Expose
private String lemma_tur;
@SerializedName("lemma_ortaharf")
@Expose
private String lemma_ortaharf;
@SerializedName("lemma_masdar")
@Expose
private String lemma_masdar;
@SerializedName("lemma_mfiil")
@Expose
private String lemma_mfiil;
@SerializedName("lemma_emir")
@Expose
private String lemma_emir;
@SerializedName("lemma_fiilform")
@Expose
private String lemma_fiilform;
@SerializedName("lemma_transitive")
@Expose
private String lemma_transitive;
@SerializedName("lemma_tekil")
@Expose
private String lemma_tekil;
@SerializedName("lemma_cogul")
@Expose
private String lemma_cogul;
@SerializedName("lemma_favori")
@Expose
private String lemma_favori;
@SerializedName("stemler")
@Expose
@Relation(idProperty = "lemma_id")
private List<Stem> stemler;
@Transient
public boolean isFavori;
@Transient
private Spannable formatted;
}
I tried deleting generated classes and the .json file. But nothing solved my problem
Can you post your Java include statements and your gradle configuration? Are there any other Gradle plugins you are using?
These are all imports for class:
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import io.objectbox.annotation.Entity;
import io.objectbox.annotation.Id;
import io.objectbox.annotation.Generated;
This is the class after generation:
package arapcadictionary.arappca.com.arapcasozluk.objectmodels;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import io.objectbox.annotation.Entity;
import io.objectbox.annotation.Generated;
import io.objectbox.annotation.Id;
@Entity(generateGettersSetters = false)
public class TabloAC {
@Id(assignable = true)
@SerializedName("id")
@Expose
private Long id;
@SerializedName("alan1")
@Expose
private String alan1;
@SerializedName("alan2")
@Expose
private String alan2;
@Generated(hash = 1181371016)
public TabloAC(Long id, String alan1, String alan2) {
this.id = id;
this.alan1 = alan1;
this.alan2 = alan2;
}
@Generated(hash = 751282991)
public TabloAC() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAlan1() {
return alan1;
}
public void setAlan1(String alan1) {
this.alan1 = alan1;
}
public String getAlan2() {
return alan2;
}
public void setAlan2(String alan2) {
this.alan2 = alan2;
}
//PROBLEM STARTS HERE
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
And this is module.gradle file:
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "http://objectbox.net/beta-repo/"
}
}
dependencies {
classpath 'io.objectbox:objectbox-gradle-plugin:0.9.8'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.objectbox'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "arapcadictionary.arappca.com.arapcasozluk"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
repositories {
jcenter()
mavenCentral()
maven {
url "http://objectbox.net/beta-repo/"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta5'
compile 'com.roughike:bottom-bar:2.1.1'
compile 'jp.wasabeef:recyclerview-animators:2.2.5'
compile 'com.android.support:recyclerview-v7:25.1.1'
compile 'com.ramotion.foldingcell:folding-cell:1.1.0'
compile 'com.android.support:cardview-v7:25.1.1'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.android.support:support-v4:25.1.1'
compile 'com.ifttt:sparklemotion:1.0.1'
compile 'com.eftimoff:android-viewpager-transformers:1.0.1@aar'
compile 'com.bcgdv.asia.lib:fanmenu:1.2'
compile 'com.github.arimorty:floatingsearchview:2.0.3'
compile 'com.ashokvarma.android:bottom-navigation-bar:1.3.0'
compile 'com.nightonke:boommenu:2.0.7'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'io.reactivex:rxjava:1.1.0'
compile 'io.objectbox:objectbox-android:0.9.8'
testCompile 'junit:junit:4.12'
compile project(':likebutton')
compile project(':appIntro')
}
After last post, I changed my gradle structers (modul level and project level) as in example application but this not worked also.
And I changed @Entity(generateGettersSetters = true) not false
and this not worked also. Always creates getters and setters.
Did not spot anything fishy here.
So, to recap:
Is this correct?
Some random ideas:
Yes, only for ID getter and setter regenerating and only for some classes.
Yes, If I delete the GSON annotations, nothing changed.
Yes, other properties work fine. (Edit:Maybe because of stopping compile progress, If it continue other properties can also occur same thing.)
Yes, I don't use any other plugin.
ID type is already Long as seen in code above. (Edit:And I tried long)
At the begining since there is no getter&setter, after make project all constructer and getters&setters createting without problem or if I click play button directly runs normally. Then If I click play or make project button again creating new getter&setter for Id property and stop compiling with error getId and setId already exists.
When I delete all generated code and click make project or play botton, it runs without problem. But only for one time. Then same problem if I click again.
Thanks for the info.
I meant long (lower case) vs. Long. Can you try long?
Also, can you try to put all your entities in the example project and check what will happen in this context?
Ok. I will try Edit: applying long instead of Long not solved. Now trying with example project.
Edit2: First I tried my files with example project and got same error again also with Note.java class. Then I opened example project in another folder. Tried before adding anything. And same problem appeared on Note.java class. I am sure, before doing anything. Only clicked make project button.
Maybe this will be helpfull.
I changed name of id
property to _id
with the clear example application.
then changed also related caller methods from note.getId
to note.get_id
and now there is no problem. I can compile and run again and again. This is why my other 2 classes running correct. Their names are different from "id". some text followed by "id" like lemma_id and stem_id. So structure not accepts "id" as property name.
We were unable to reproduce. This issue may be gone with our new build tooling, once it will also take care of the Java side.
We are deprecating source code generation; so we won't investigate further.
@Entity public class TabloAB { @SerializedName("id") @Expose @Id(assignable = true) private Long id; @SerializedName("alan1") @Expose private String alan1; @SerializedName("alan2") @Expose private String alan2; }
This is my class decleration. When I click Make Project it generates automatically getters and setters for all properties. But when I clicked the play button or make project button again it regenerates the id getter and setter. So, can not compile project. I have 6 class uses @Entity annotation but I have this problem with 4 classes. @SerializedName and @Expose annotations not effect this. Because other 2 classes don't have this problem.