I am trying to use Firestore
. I need to get all images urls which are stored in a folder in Firestore
. I am currently following This.
When using:
db.collection("images")
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
for (QueryDocumentSnapshot document : task.getResult()) {
Log.d(TAG, document.getId() + " => " + document.getData());
}
} else {
Log.w(TAG, "Error getting documents.", task.getException());
}
}
});
I am getting the error below.
Initially i was getting
Program type already present: com.google.common.annotations.GwtCompatible
That was resolved by :
implementation ("com.google.firebase:firebase-firestore:17.0.3"){
exclude group: 'com.google.guava'
}
java.lang.RuntimeException: Internal error in Firestore (0.6.6-dev).
at com.google.firebase.firestore.g.zza.zzb(SourceFile:324)
at com.google.firebase.firestore.g.zzd.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.NoSuchMethodError: No static method checkArgument(ZLjava/lang/String;I)V in class Lcom/google/common/base/Preconditions; or its super classes (declaration of 'com.google.common.base.Preconditions' appears in /data/app/com.apps.dp-2wjpiDlhe60_b_F7OtfpaQ==/split_lib_dependencies_apk.apk!classes2.dex)
at com.google.firebase.Timestamp.zza(SourceFile:136)
at com.google.firebase.Timestamp.<init>(SourceFile:47)
at com.google.firebase.firestore.d.zzm.<clinit>(SourceFile:12)
at com.google.firebase.firestore.c.zzav.<init>(SourceFile:24)
at com.google.firebase.firestore.c.zzat.zzb(SourceFile:104)
at com.google.firebase.firestore.c.zzi.<init>(SourceFile:125)
at com.google.firebase.firestore.b.zzf.zza(SourceFile:1215)
at com.google.firebase.firestore.b.zzh.run(Unknown Source:8)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at com.google.firebase.firestore.g.zza$zza.run(SourceFile:190)
at java.lang.Thread.run(Thread.java:764)
07-26 09:56:29.396 25793-25793/com.apps.dp E/UncaughtException:
java.lang.RuntimeException: Internal error in Firestore (0.6.6-dev).
at com.google.firebase.firestore.g.zza.zzb(SourceFile:324)
at com.google.firebase.firestore.g.zzd.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.NoSuchMethodError: No static method checkArgument(ZLjava/lang/String;I)V in class Lcom/google/common/base/Preconditions; or its super classes (declaration of 'com.google.common.base.Preconditions' appears in /data/app/com.apps.dp-2wjpiDlhe60_b_F7OtfpaQ==/split_lib_dependencies_apk.apk!classes2.dex)
at com.google.firebase.Timestamp.zza(SourceFile:136)
at com.google.firebase.Timestamp.<init>(SourceFile:47)
at com.google.firebase.firestore.d.zzm.<clinit>(SourceFile:12)
at com.google.firebase.firestore.c.zzav.<init>(SourceFile:24)
at com.google.firebase.firestore.c.zzat.zzb(SourceFile:104)
at com.google.firebase.firestore.c.zzi.<init>(SourceFile:125)
at com.google.firebase.firestore.b.zzf.zza(SourceFile:1215)
at com.google.firebase.firestore.b.zzh.run(Unknown Source:8)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at com.google.firebase.firestore.g.zza$zza.run(SourceFile:190)
at java.lang.Thread.run(Thread.java:764)
I am struggling on this from last 6 hours . Can i get some help on this . I have a question also is it possible to get all images urls from a folder using Firestore
APi in android . Or i have save those URls in Firebase database first ? Already checked out some posts on this Like this one which says its not possible .