When I run
import ImagePicker from 'react-native-image-picker';
import firebase from 'react-native-firebase';
const storage = firebase.storage();
const mRef = storage.ref('images').child('cat-image.jpeg');
const pickerOptions = {
mediaType: 'photo',
};
ImagePicker.showImagePicker(pickerOptions, (response) => {
if (response.error || response.didCancel) {
return;
}
mRef.putFile(response.path, { contentType: response.type });
});
The picture is uploaded to the storage bucket but the app crashes. I'm using Crashalytics (Yay!). The crash report says:
RNFirebaseStorage.java line 484
No virtual method getDownloadUrl()Landroid/net/Uri; in class Lcom/google/firebase/storage/UploadTask$TaskSnapshot; or its super classes (declaration of 'com.google.firebase.storage.UploadTask$TaskSnapshot' appears in /data/app/br.unb.observatorioderesiduos-1/base.apk:classes2.dex)
io.invertase.firebase.storage.RNFirebaseStorage.getUploadTaskAsMap (RNFirebaseStorage.java:484)
io.invertase.firebase.storage.RNFirebaseStorage.access$400 (RNFirebaseStorage.java:45)
io.invertase.firebase.storage.RNFirebaseStorage$15.onProgress (RNFirebaseStorage.java:374)
io.invertase.firebase.storage.RNFirebaseStorage$15.onProgress (RNFirebaseStorage.java:370)
com.google.firebase.storage.zzs.zza (Unknown Source)
com.google.firebase.storage.zzac.zzb (Unknown Source)
com.google.firebase.storage.zzae.run (Unknown Source)
android.os.Handler.handleCallback (Handler.java:751)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6692)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1468)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1358)
The app was running on a Galaxy S7, Android 7.0.
My bad. I double checked my app/build.gradle and the firebase package versions were wrong.
What mine was:
implementation "com.google.firebase:firebase-storage:16.0.1"
What it should be:
implementation "com.google.firebase:firebase-storage:15.0.2"
Changed the version and rebuilt, error went away.
@chrisbianca @Salakar - can you check this? I don't think this should be closed.
The release docs state:
Update android/app/build.gradle
You need to be using at least the following versions of the firebase and gms imports:
You says at least :) And Android studio always "asks" you to update the dependencies to the latest versions.
Should we stay at 15.x.x for everything firebase related or can we update to the latest sdk versions?
My dependencies are set like this:
implementation 'com.google.firebase:firebase-core:16.0.0'
// RNFirebase optional dependencies
// implementation "com.google.firebase:firebase-ads:12.0.1"
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-firestore:17.0.1'
implementation 'com.google.firebase:firebase-functions:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-analytics:16.0.0'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
with storage 16.0.1 I get the same error as @husscode and it took quite a while to figure out that it is a version issue, not an issue in my code. I guess that others are suffering from this too.
I agree with @compojoom. I was facing the same issue for android, not ios, using the firebasae storage 16.0.2 version. After changing to 15.0.2 it worked.
You're right, we currently only support version 15 of the libraries, other than version 16 of firestore. The build-issues branch supports the latest versions and we'll look to get this released as soon as we can.
@flasd
hi,
i tried to lower the firebase-storage version to 15.0.2
implementation "com.google.firebase:firebase-storage:15.0.2"
but still got this error:
08-13 15:43:48.280 2209 30494 W ErrorReporter: reportError [type: 211, code: 524300]: Error reading from input stream
08-13 15:43:48.281 2209 30494 W ErrorProcessor: onFatalError, processing error from engine(4)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: com.google.android.apps.gsa.shared.speech.b.g: Error reading from input stream
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at com.google.android.apps.gsa.staticplugins.recognizer.j.a.a(SourceFile:28)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at com.google.android.apps.gsa.staticplugins.recognizer.j.b.run(SourceFile:15)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at com.google.android.apps.gsa.shared.util.concurrent.a.ag.run(Unknown Source:4)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at com.google.android.apps.gsa.shared.util.concurrent.a.bo.run(SourceFile:4)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at com.google.android.apps.gsa.shared.util.concurrent.a.bo.run(SourceFile:4)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at java.lang.Thread.run(Thread.java:764)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:6)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: Caused by: com.google.android.apps.gsa.shared.exception.GsaIOException: Error code: 393238 | Buffer overflow, no available space.
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at com.google.android.apps.gsa.speech.audio.Tee.f(SourceFile:103)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at com.google.android.apps.gsa.speech.audio.au.read(SourceFile:2)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at java.io.InputStream.read(InputStream.java:101)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at com.google.android.apps.gsa.speech.audio.ao.run(SourceFile:18)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: at com.google.android.apps.gsa.speech.audio.an.run(SourceFile:2)
08-13 15:43:48.281 2209 30494 W ErrorProcessor: ... 11 more
can you post your build.gradle and app/build.gradle ?
which gradle-wrapper.properties version you used?
thanks
@flasd, did you solve the issue?
Hi @knsakib and @flasd,
I had the same issue after updating to com.google.firebase:firebase-storage:16.0.1 with version 4.2.0 of react-native-firebase. After updating react-native-firebase to the newest 4.X.X version (4.3.8 at the moment), everything works fine and there are no more crashes.
So just use com.google.firebase:firebase-storage:16.0.1 in your dependencies in your build.gradle and the newest version of react-native-firebase in your package.json
Most helpful comment
My bad. I double checked my app/build.gradle and the firebase package versions were wrong.
What mine was:
What it should be:
Changed the version and rebuilt, error went away.