Tôi hoàn toàn mới đến vương quốc. Tôi muốn sử dụng db realm trong dự án Android của tôi. Tôi đã đi qua chính thức Realm documentation. Tôi cần phải thiết lập lĩnh vực trong dự án Android của tôi. Cho rằng tôi đã thêm dependancy gradle nhưLàm thế nào để cài đặt lĩnh vực như một sự phụ thuộc gradle?
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:0.88.2"
}
}
apply plugin: 'realm-android'
Đây là những gì họ đã được đưa ra trong tài liệu. Nhưng điều này không hiệu quả với tôi. Nó cho lỗi nói rằng Plugin with id 'realm-android' not found
.
Đây là tập tin build.gradle tôi
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.db.realmsample"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:0.88.2"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
}
là cấu hình của tôi có đúng không?
Từ các tài liệu Realm nay là phiên bản mới nhất là '3.3.1' tức, 'classpath "io.realm: realm- gradle-plugin: 3.3.1 "' Tham khảo: https://realm.io/docs/java/latest/#installation –