Am trying to add Realm to my project but when running I get the following build error from gradle:
Error:Execution failed for task ':sdksampleapp:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/services/javax.annotation.processing.Processor
File1: /Users/name/.gradle/caches/modules-2/files-2.1/com.jakewharton/butterknife/7.0.1/d5d13ea991eab0252e3710e5df3d6a9d4b21d461/butterknife-7.0.1.jar
File2: /Users/name/.gradle/caches/modules-2/files-2.1/io.realm/realm-android/0.84.1/b86074e6240f0f876701810a047b0261f7bd060e/realm-android-0.84.1.jar
I have tried adding:
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
to my build.gradle in my android{} block, but that does not seem to fix the issue.
I'm adding Realm via
compile 'io.realm:realm-android:0.84.1'
Have tried cleaning/rebuilding etc but still get the issue when trying to run the project. Any ideas?