ObjectBox doesn't generate getters and constructors within entities -
i'm trying started ob using page http://objectbox.io/documentation/introduction/
i create new project in android studio 2.3.3
my gradle files:
root:
// top-level build file can add configuration options common sub-projects/modules. buildscript { repositories { jcenter() maven { url "http://objectbox.net/beta-repo/" } } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' classpath "io.objectbox:objectbox-gradle-plugin:1.0.1" } } allprojects { repositories { jcenter() maven { url "http://objectbox.net/beta-repo/" } } } task clean(type: delete) { delete rootproject.builddir }
app:
apply plugin: 'com.android.application' apply plugin: 'io.objectbox' android { compilesdkversion 26 buildtoolsversion "26.0.1" defaultconfig { applicationid "com.example.obox" minsdkversion 16 targetsdkversion 26 versioncode 1 versionname "1.0" testinstrumentationrunner "android.support.test.runner.androidjunitrunner" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) 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:26.+' compile 'com.android.support.constraint:constraint-layout:1.0.2' testcompile 'junit:junit:4.12' compile "io.objectbox:objectbox-android:1.0.1" annotationprocessor "io.objectbox:objectbox-processor:1.0.1" }
it doesn't work , without 2 lower lines in app-gradle file.
my entity class:
package com.example.obox; import io.objectbox.annotation.entity; import io.objectbox.annotation.id; @entity public class mymodel { @id private long id; private string content; }
no generated code added. errors while trying make project.
.../mymodelcursor.java error:(45, 32) error: cannot find symbol method getcontent() error:(48, 57) error: cannot find symbol method getid() error:(56, 15) error: cannot find symbol method setid(long) .../mymodel_.java error:(91, 26) error: cannot find symbol method getid()
objectbox not generate code source files (unlike greendao). have 2 options:
- make fields package private removing
private
- provide standard getters (your ide can generate them easily)
Comments
Post a Comment