I use Glide 4.9.0 to load pictures, but I want to load firebase pictures, so I create a class MyAppGlideModule
to override, after that I clean my project and rebuild it, but it still can't use GlideApp
to load pictures, MyAppGlideModule
still show not used.
I didn't add annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
in my code, because after I migrate to AndroidX
, it will get compile error.
How can I fixed it, or it has any way to show firebase pictures, thank you.
Here is my MyAppGlideModule
class:
@GlideModule
public class MyAppGlideModule extends AppGlideModule {
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
registry.append(StorageReference.class, InputStream.class,
new FirebaseImageLoader.Factory());
}
}
Here is I want to load pictures in recyclerview:
StorageReference pathReference = FirebaseStorage.getInstance().getReference().child(post.img);
Glide.with(mContext)
.load(pathReference)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.placeholder(R.drawable.ic_load_img)
.into(((PostViewHolder) holder).postcard_img);
Here is my bulide.gradle:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.browser:browser:1.0.0'
implementation 'com.android.billingclient:billing:2.0.2'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.github.chrisbanes:PhotoView:2.1.4'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.github.bumptech.glide:annotations:4.9.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.google.firebase:firebase-auth:18.1.0'
implementation 'com.google.firebase:firebase-storage:18.1.1'
implementation 'com.google.firebase:firebase-database:18.0.1'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation 'com.google.firebase:firebase-ads:18.1.1'
implementation 'com.firebaseui:firebase-ui-storage:5.0.0'
implementation 'com.facebook.android:audience-network-sdk:5.4.1'
implementation 'com.facebook.android:facebook-android-sdk:5.4.0'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation files('libs/jsch-0.1.55.jar')
}
if I add annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
in build.grade, I will get these error code:
C:/Users/Myapp/AndroidStudioProjects/PGapp
app/build/generated/source/apt/debug/com/gmpsykr/goma/GlideOptions.java
error: package android.support.annotation does not exist
error: package android.support.annotation does not exist
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
error: cannot find symbol class CheckResult
app/build/generated/source/apt/debug/com/gmpsykr/goma/GlideRequest.java
app/build/generated/source/apt/debug/com/gmpsykr/goma/GlideRequests.java
app/build/generated/source/apt/debug/com/bumptech/glide/GeneratedRequestManagerFactory.java
app/build/generated/source/apt/debug/com/bumptech/glide/GeneratedAppGlideModuleImpl.java
I found the solution, add
implementation "com.android.support:support-annotations:28.0.0"
annotationProcessor "com.android.support:support-annotations:28.0.0"
it seems Glide 4.9.0 not support AndroidX yet.