Skip to content Skip to sidebar Skip to footer

Android, Realm, Gradle: Error:annotation Processor: Realmprocessor Not Found

Android Studio 2.3.3 My project bulid.gradle: // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_vers

Solution 1:

I found solution. Two approach:

  1. By apt plugin

in app's budile.gradle:

apply plugin: 'com.neenbedankt.android-apt'

apt {
    arguments {

        resourcePackageName android.defaultConfig.applicationId

        androidManifestFile variant.outputs[0]?.processResources?.manifestFile
    }

}

dependencies {
apt 'io.realm:realm-android-library:3.5.0'
apt "org.androidannotations:androidannotations:$AAVersion"
}

OR

  1. By kapt plugin

    apply plugin: 'kotlin-kapt'
    
    kapt {
    
        arguments {
    
            arg( "resourcePackageName", android.defaultConfig.applicationId)
    
            arg( "androidManifestFile", 
    
            variant.outputs[0]?.processResourcesTask?.manifestFile)
    
        }
    
    }
    

    dependencies {

    kapt 'io.realm:realm-android-library:3.5.0'
    
    kapt "org.androidannotations:androidannotations:$AAVersion"

    }

Solution 2:

If you use Kotlin, then you'll need to use KAPT.

annotationProcessor "org.androidannotations:androidannotations:$AAVersion"

should be

kapt "org.androidannotations:androidannotations:$AAVersion"

and

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'

should be

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'

and

//       javaCompileOptions {//           annotationProcessorOptions {//               arguments = ["resourcePackageName": android.defaultConfig.applicationId]//           }//       }

kapt {
    arguments {
        arg('resourcePackageName', android.defaultConfig.applicationId)
    }
}

EDIT: based on https://stackoverflow.com/a/34708575/2413303

kapt {
    arguments {
        arg('androidManifestFile', variant.outputs[0]?.processResources?.manifestFile)
        arg('resourcePackageName', android.defaultConfig.applicationId)
    }
}

If that still doesn't work, then the question becomes AndroidAnnotations related.

Post a Comment for "Android, Realm, Gradle: Error:annotation Processor: Realmprocessor Not Found"