realm android无法解析符号“syncuser”

elcex8rz  于 2021-07-11  发布在  Java
关注(0)|答案(1)|浏览(335)

每当我尝试导入下面的类时,就会出现“无法解析符号”错误。

io.realm.ObjectServerError;
io.realm.SyncCredentials;
io.realm.SyncUser;

但当我尝试导入

io.realm.RealmQuery;
io.realm.RealmResults;
io.realm.Realm;

我补充说

realm{
    syncEnabled = true
}

但它仍然显示相同的错误。
这是我的app build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'realm-android'

realm{
    syncEnabled = true
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "com.example.ktoon"
        minSdkVersion 17
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

这是我的项目build.gradle:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.1"
        classpath "io.realm:realm-gradle-plugin:10.0.1"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我错过了什么?

bnl4lu3b

bnl4lu3b1#

在10.0.0中对api进行了一些突破性的更改。其中,syncuser被重命名为 io.realm.mongodb.User . 看到了吗https://github.com/realm/realm-java/blob/master/changelog.md#1000-2020-10-15为完整列表

相关问题