Java Realm android,Realm Transformer不';似乎不适用
我是新手 我使用:Java Realm android,Realm Transformer不';似乎不适用,java,android,realm,Java,Android,Realm,我是新手 我使用: Android studio 2.2.3 格拉德尔:2.14.1 领域插件:“类路径”io。领域:领域渐变插件:2.2.1 但是当我调用Realm.init(context)时,它抛出了一个异常;在我的活动中 日志: Build.gradle模块级别: apply plugin: 'com.android.application' apply plugin: 'realm-android' android { compileSdkVersion 25 b
- Android studio 2.2.3
- 格拉德尔:2.14.1
- 领域插件:“类路径”io。领域:领域渐变插件:2.2.1
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "*.demo"
minSdkVersion 10
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
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:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.github.pwittchen:reactivenetwork:0.7.0'
testCompile 'junit:junit:4.12'
}
提前感谢您的帮助。您需要将其添加到您的d build.gradle文件中:
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:2.2.1"
}
然后做:
完成这两项更改后,只需刷新gradle依赖项即可。如果您是从v0.88之前的版本升级,您可能还需要清理gradle项目(./gradlew clean)以删除任何延迟的以前安装
可以在Realm网站上找到说明。Jack不能使用Gradle中的转换API 因此,依赖于TransformAPI的领域转换器不能与Jack一起使用
使用Retrolambda代替Jack支持Java 8功能 感谢您的回复,事实上这就是答案,从那时起,所有的工作都像个魔术师,Jack已经被弃用了,android工具3.x将破坏Retrolambda,但是内置了lambda支持,这很好。我正在使用Kotlin,我不需要/使用Jack或Retrolambda,但我仍然有同样的问题!有什么帮助吗@EpicPandaForce@leodev然后你只是没有应用pluginI发现问题是由androidstudio在切换分支后保留的一个脏文件引起的。还是谢谢你
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "*.demo"
minSdkVersion 10
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
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:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.github.pwittchen:reactivenetwork:0.7.0'
testCompile 'junit:junit:4.12'
}
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:2.2.1"
}