Henrique Mendes Henrique Mendes - 1 year ago 380
Android Question

Error adding library Room Persistence

I'm starting to work with room persistence

I added the room in the gradle and the error below appeared:


Error:Failed to resolve: annotationProcessor

href="openFile:C:/.../app/build.gradle">Open File


This error appears when I synchronize the gradle

How can I resolve this issue?

This is the gradle project:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}

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


app gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
dataBinding {
enabled = true
}
defaultConfig {
applicationId "com.app.bob.app"
minSdkVersion 22
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:support-annotations:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.android.support:support-v4:25.3.0'
testCompile 'junit:junit:4.12'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton:butterknife:8.7.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
compile 'com.android.support:cardview-v7:25.3.0'
compile 'android.arch.persistence.room:runtime: 1.0.0-alpha5'
annotationProcessor 'android.arch.persistence.room:compiler: 1.0.0-alpha5'
compile 'android.arch.lifecycle:runtime:1.0.0-alpha5'
compile 'android.arch.lifecycle:extensions:1.0.0-alpha5'
annotationProcessor 'android.arch.lifecycle:compiler:1.0.0-alpha5'
testCompile 'android.arch.persistence.room:testing:1.0.0-alpha5'
compile 'android.arch.persistence.room:rxjava2:1.0.0-alpha5'
}

Answer Source

Remove all whitespace from your compile values. IOW, replace:

compile 'android.arch.persistence.room:runtime: 1.0.0-alpha5'
annotationProcessor 'android.arch.persistence.room:compiler: 1.0.0-alpha5'

with:

compile 'android.arch.persistence.room:runtime:1.0.0-alpha5'
annotationProcessor 'android.arch.persistence.room:compiler:1.0.0-alpha5'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download