72864

Realm annotation processor error not picking up

Question:

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 error I get:

"Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration. - realm-android-0.82.1.jar (io.realm:realm-android:0.82.1)"

Please help.

App.Gradle

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' implementation 'io.realm:realm-android:0.82.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' }

Project.gradle

buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.4' // 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 }

Please assist!

Answer1:

Follow the instructions as mentioned in <a href="https://realm.io/docs/java/latest/" rel="nofollow">realm docs</a>

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' }

Recommend

  • Reflection not working on android release apk. Even with proguard/minify disabled
  • Instrumentation run failed due to 'java.lang.NoClassDefFoundError' after adding multidex t
  • Firebase database is not updating with no errors, slow response
  • Android organizing layout resourse?
  • problems with 'com.android.support:appcompat-v7.27.1.1' in the gradle file
  • Kotlin fails to compile a library
  • Gitlab CI runner not building or showing any output
  • Execution failed for task : 'app.transformClassesWithDesugarForDebug'. after importing pro
  • How to use Android's AppCompat theming application-wide?
  • Dependency commons-logging:commons-logging:1.2 is ignored for debug as it may be conflicting with th
  • NUnit Multiple TestFixture with different Category attribute
  • Ionic App On Android Tablet
  • How to pause and resume a simple game in Java
  • Possible F# type inference limitation
  • How to run a single row of a Cucumber scenario outline example table in RubyMine?
  • Proguard Exception java.io.IOException: Duplicate zip entry
  • python: forcing relative imports to search from script file
  • How to resolve permission denied maybe missing internet permission?
  • Xamarin Android | Layout style
  • Enabling DTD support in Sql Server
  • How to get current document uri in XSLT?
  • Web.config system.webserver errors
  • ADO and msqli connections very slow
  • How can the INSERT … ON CONFLICT (id) DO UPDATE… syntax be used with a sequence ID?
  • Problems compiling files using JOGL
  • Installing Apache MyFaces 2 on WildFly 8.2.0
  • HTTP/2 streams vs HTTP/1.1 connections
  • Hardware Accelerated Image Scaling in windows using C++
  • Bad request using file_get_contents for PUT request in PHP
  • Python urlparse: small issue
  • Display issues when we change from one jquery mobile page to another in firefox
  • Deselecting radio buttons while keeping the View Model in synch
  • SSO with signing and signature validation doesn't work
  • Deserializing XML into class C#
  • Can I make an Android app that runs a web view in Chrome 39?
  • JSON with duplicate key names losing information when parsed
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Jquery - Jquery Wysiwyg return html as a string
  • How to include full .NET prerequisite for Wix Burn installer
  • costura.fody for a dll that references another dll