Jeff McBride
Jeff McBride

Reputation: 83

get image from Firebase storage. GlideApp unresolved reference

I have tried literally every solution on the web to try and resolve GlideApp with no success. Is there another method I can use to retrieve an image from Firebase Storage and put into an ImageView instead of glide? I worry that if it's this hard to find a solution to using Glide initially, what's gonna happen down the line? Google recommends it, but I just cannot get it to work. Here's what I'm implementing:

implementation "com.github.bumptech.glide:glide:4.3.1"
Implementation "com.github.bumptech.glide:okhttp3-integration:4.3.1"
kapt "com.github.bumptech.glide:compiler:4.3.1"1

and here's my fragment code:

val storageRef = data.getReference()
val pathReference = storageRef.child(user?.uid.toString() + "/images/coverphoto")
GlideApp.with(context)
        .load(pathReference)
        .into();

It really shouldn't be this difficult to initially use Glide.

I should mention that this is a kotlin project and that I am trying to access the image in a fragment.

Just in case you need it:

repositories {
    maven {
        url "https://dl.bintray.com/kotlin/exposed"
    }
    mavenCentral()
    maven { url 'https://maven.google.com' }
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    implementation 'com.google.firebase:firebase-core:11.8.0'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-storage:11.8.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'org.jetbrains.anko:anko-common:0.9'
    implementation 'com.beust:klaxon:3.0.1'
    implementation "com.android.support:recyclerview-v7:27.1.1"
    testImplementation 'junit:junit:4.12'
    implementation "com.github.bumptech.glide:glide:4.3.1"
    implementation "com.github.bumptech.glide:okhttp3-integration:4.3.1"
    kapt "com.github.bumptech.glide:compiler:4.3.1"
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android-extensions'

****2nd Update****

Here's my ful gradle.build file:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.ntx_deisgns.cyberchatter.cyberchatter"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        customDebugType {
            debuggable true
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    maven {
        url "https://dl.bintray.com/kotlin/exposed"
    }
    mavenCentral()
    maven { url 'https://maven.google.com' }
}
dependencies {
//    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    implementation 'com.google.firebase:firebase-core:11.8.0'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-storage:11.8.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'org.jetbrains.anko:anko-common:0.9'
    implementation 'com.beust:klaxon:3.0.1'
    implementation "com.android.support:recyclerview-v7:27.1.1"
    testImplementation 'junit:junit:4.12'
    implementation 'com.github.bumptech.glide:annotations:4.7.1'
    kapt 'com.github.bumptech.glide:compiler:4.7.1'
    implementation "com.github.bumptech.glide:okhttp3-integration:4.6.1"
    implementation 'com.github.bumptech.glide:annotations:4.7.1'
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

Upvotes: 1

Views: 1340

Answers (2)

Rozina
Rozina

Reputation: 409

I have solved by :

  • Click menu Build
  • Click Make Module

And GlideApp Class will automatically generated

Upvotes: 0

EpicPandaForce
EpicPandaForce

Reputation: 81539

Add this class anywhere in your app module and it'll work:

import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.module.AppGlideModule

@GlideModule
class RequiredAppGlideModule : AppGlideModule()

And don't forget the glide compiler:

implementation 'com.github.bumptech.glide:annotations:4.7.1'
kapt 'com.github.bumptech.glide:compiler:4.7.1'
implementation "com.github.bumptech.glide:okhttp3-integration:4.6.1"
implementation 'com.github.bumptech.glide:annotations:4.7.1'

And make sure you also do

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

Upvotes: 2

Related Questions