找不到领域依赖

Cant find realm dependency

所以我的项目似乎无法解决领域依赖。我已经多次使用 realm 并且之前没有遇到过这个问题 - 希望我只是累了并且遗漏了一些愚蠢和明显的东西。

我按照此处的说明操作: https://docs.mongodb.com/realm-legacy/docs/java/latest/#installation

和其他 SO 答案,但我没有运气......这是我的 gradle 文件

project gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.5.0"
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.2.1"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath "io.realm:realm-gradle-plugin:10.0.1"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter() // Warning: this repository is going to shut down soon
    }

}

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

app gradle file

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-kapt'
}
apply plugin: 'realm-android'

android {
    compileSdkVersion 30

    defaultConfig {
        applicationId "ca.test.sdkpackedtest"
        minSdkVersion 16
        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
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {
    api 'com.google.android.material:material:1.2.1'

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.core:core-ktx:1.3.1'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.1'

    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

错误:

A problem occurred configuring root project 'SDKPackedTest'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find io.realm:realm-gradle-plugin:10.0.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/io/realm/realm-gradle-plugin/10.0.1/realm-gradle-plugin-10.0.1.pom
       - https://repo.maven.apache.org/maven2/io/realm/realm-gradle-plugin/10.0.1/realm-gradle-plugin-10.0.1.pom
     Required by:
         project :

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html


自版本 10.4.0 以来,领域在 mavenCantral 中可用。 更新版本或添加 jcenter