(1) Open the Application
(2) Click on the Avatar Icon
(3) Choose Image Source Select the option to upload an image from either the gallery or camera.
(4) Error in Logcat
Other information
Device : Android 13
Attempt to invoke virtual method 'java.lang.String com.getcapacitor.JSObject.getString(java.lang.String)' on a null object reference
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.getcapacitor.JSObject.getString(java.lang.String)' on a null object reference
at io.capawesome.capacitorjs.plugins.firebase.storage.FirebaseStorageHelper.buildStorageMetadata(FirebaseStorageHelper.java:12)
at io.capawesome.capacitorjs.plugins.firebase.storage.classes.options.UploadFileOptions.(UploadFileOptions.java:23)
at io.capawesome.capacitorjs.plugins.firebase.storage.FirebaseStoragePlugin.uploadFile(FirebaseStoragePlugin.java:204)
at java.lang.reflect.Method.invoke(Native Method)
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:138)
at com.getcapacitor.Bridge.lambda$callPluginMethod$0(Bridge.java:800)
at com.getcapacitor.Bridge.$r8$lambda$ehFTi5f4HhVNFKTbCKAYDkpQYRA(Unknown Source:0)
at com.getcapacitor.Bridge$$ExternalSyntheticLambda3.run(Unknown Source:8)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.os.HandlerThread.run(HandlerThread.java:67)
Plugin(s)
Version
5.4.1
Platform(s)
Current behavior
Attempting to upload an image file to Firebase Cloud Storage, encountering an error:
Error message: "Attempt to invoke virtual method 'java.lang.String com.getcapacitor.JSObject.getString(java.lang.String)' on a null object reference"
current setup : uploadProfileFile = async () => { await FirebaseStorage.uploadFile( { path: 'images/17852709929324920.jpeg', uri: 'file:///data/user/0/com.testing.cloudstorage/cache/17852709929324920.jpeg', }, (event, error) => { if (error) { console.log(error); console.log('error'); } else if (event?.completed) { console.log('upload complete') } } ); };
I've tried an alternative method to verify the setup, and it's functioning correctly. I'm receiving responses from Firebase storage.
listFiles = async () => { const { items } = await FirebaseStorage.listFiles({ path: 'images', }); return items; };
Expected behavior
The Firebase Cloud Storage upload feature should function as intended, allowing users to seamlessly upload files to the designated storage location.
Reproduction
https://github.com/shaktis110/firebase-storage-test-app.git
Steps to reproduce
(1) Open the Application (2) Click on the Avatar Icon (3) Choose Image Source Select the option to upload an image from either the gallery or camera. (4) Error in Logcat
Other information
Device : Android 13
Attempt to invoke virtual method 'java.lang.String com.getcapacitor.JSObject.getString(java.lang.String)' on a null object reference java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.getcapacitor.JSObject.getString(java.lang.String)' on a null object reference at io.capawesome.capacitorjs.plugins.firebase.storage.FirebaseStorageHelper.buildStorageMetadata(FirebaseStorageHelper.java:12) at io.capawesome.capacitorjs.plugins.firebase.storage.classes.options.UploadFileOptions.(UploadFileOptions.java:23)
at io.capawesome.capacitorjs.plugins.firebase.storage.FirebaseStoragePlugin.uploadFile(FirebaseStoragePlugin.java:204)
at java.lang.reflect.Method.invoke(Native Method)
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:138)
at com.getcapacitor.Bridge.lambda$callPluginMethod$0(Bridge.java:800)
at com.getcapacitor.Bridge.$r8$lambda$ehFTi5f4HhVNFKTbCKAYDkpQYRA(Unknown Source:0)
at com.getcapacitor.Bridge$$ExternalSyntheticLambda3.run(Unknown Source:8)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.os.HandlerThread.run(HandlerThread.java:67)
Capacitor doctor
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 5.7.2 @capacitor/core: 5.7.2 @capacitor/android: 5.7.2 @capacitor/ios: 5.7.2
Installed Dependencies:
@capacitor/ios: not installed @capacitor/cli: 5.7.2 @capacitor/android: 5.7.2 @capacitor/core: 5.7.2
[success] Android looking great! 👌
Before submitting