android - Realm method "Cannot Resolve Symbol" -


i'm using realm android create database app wheme go try call method realm.begintrasnaction(), tell me android studio cannot resolve symbol.

here's piece of code:

import io.realm.realm;  public class playercreator {  realm realm = realm.getdefaultinstance();  realm.begintransaction();  } 

and here's gradle files:

project gradle:

buildscript {     repositories {         jcenter()     }     dependencies {         classpath 'com.android.tools.build:gradle:1.5.0'         classpath "io.realm:realm-gradle-plugin:3.5.0"      } }  allprojects {     repositories {         jcenter()     } }  task clean(type: delete) {     delete rootproject.builddir } 

module gradle:

apply plugin: 'com.android.application' apply plugin: 'realm-android'  android {     compilesdkversion 24     buildtoolsversion "24.0.1"      defaultconfig {         applicationid "tfdev.avventuratestuale"         minsdkversion 18         targetsdkversion 24         versioncode 1         versionname "1.0"     }     buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'         }     } }  dependencies {     compile filetree(dir: 'libs', include: ['*.jar'])     testcompile 'junit:junit:4.12'     compile 'com.android.support:appcompat-v7:24.1.1' } 

does know how can use realm.begintransaction() ?

ok, i've fixxed added constructor of playercreator class, murat k.

import io.realm.realm; import io.realm.realmobject;  public class playercreator extends realmobject{      public playercreator(){          realm realm = realm.getdefaultinstance();          realm.begintransaction();      } } 

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -