realm.beginTrasnaction()
,它告诉我Android Studio无法解析符号。
以下是我的代码:
import io.realm.Realm;
public class playerCreator {
Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
}
这是我的gradle文件:
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
}
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'
}
有人知道我如何使用领域吗。beginTransaction()?