Hot questions for Using Glide in android room

Top 10 Java Open Source / Glide / android room

Question:

I noticed that I have to use kapt instead of annotationProcessor to make Dagger 2 work properly in my Kotlin project. Do I have to do the same to all the libraries (specifically Glide and Room)?


Answer:

Yes, it is recommended to do so. The documentation stated:

If you previously used the Android support for annotation processors, replace usages of the annotationProcessor configuration with kapt. If your project contains Java classes, kapt will also take care of them.

Read more on Using kapt

Question:

below is my build.gradle file dependencies

dependencies {
    def room_version = "1.1.1"

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.android.support:design:28.0.0-alpha1'
    implementation 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.android.support:support-vector-drawable:28.0.0'
    implementation 'com.android.support:exifinterface:28.0.0'
    implementation 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1'
    implementation('com.github.castorflex.verticalviewpager:library:19.0.1') {
        exclude group: 'com.android.support'
        exclude module: 'appcompat-v7'
        exclude module: 'support-v4'
    }
    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'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
    android {
        useLibrary 'org.apache.http.legacy'
    }
    implementation("com.github.bumptech.glide:glide:4.8.0") {
        exclude group: "com.android.support"
    }
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation "android.arch.persistence.room:runtime:$room_version"
    annotationProcessor "android.arch.persistence.room:compiler:$room_version"


}

I am using two plugin annotationProcessor one for Room database and other for Glide Plugin but as soon as i add annotationProcessor for Room Database. It seem GLide annotationProcessor is getting override and I am getting compilation error for Glide Plugin in my project. How to run both in my project ?


Answer:

Make sure your root gradle look like this:

allprojects {
repositories {
    jcenter()
    google()
 }