Skip to content Skip to sidebar Skip to footer

Realm Annotation Processor Error Not Picking Up

I have been getting the error about the annotation processor for the Realm library fails to load, am I missing something? Where do I add it in or what should I do? This is the erro

Solution 1:

Follow the instructions as mentioned in realm docs

Step 1: Add the class path dependency to the project level build.gradle file. (Which you refer to as Project gradle in question)

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

Step 2: Apply the realm-android plugin to the top of the application level build.gradle file. (Which you refer to as App gradle in question)

apply plugin: 'realm-android'
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.version.crt.myapplication"
    minSdkVersion 22
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

Solution 2:

Add below two line

implementation 'io.realm:realm-android:0.82.1'
annotationProcessor 'io.realm:realm-android:0.82.1'

instead of just one line

implementation 'io.realm:realm-android:0.82.1'

should resolved the problem.

Post a Comment for "Realm Annotation Processor Error Not Picking Up"