Android Studio 3.2 Gradle3.2使用Realm出错

Android Studio3.2 Gradle3.2 使用Realm,结果gradle3.2出错了。

正常配置环境

build.gradle(project)

buildscript {
        repositories {
        jcenter()
        }
        dependencies {
        classpath "io.realm:realm-gradle-plugin:3.0.0"
        }
    }

build.gradle(module)

apply plugin: 'realm-android'

报错:

Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.

It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

从网上查资料得到解决办法是:

build.gradle(project)

classpath "io.realm:realm-transformer:2.1.1"

build.gradle(module)

import io.realm.transformer.RealmTransformer
android.registerTransform(new RealmTransformer())
dependencies {
implementation "io.realm:realm-annotations:2.1.1"
implementation "io.realm:realm-android-library:2.1.1"
annotationProcessor "io.realm:realm-annotations-processor:2.1.1"}

相关推荐