Firebase Storage download "unsupported url"

I get these two errors when trying to download a file from the Firebase Storage:

1- 

WARNING: issue found in build.settings: WARNING: unrecognized key: settings.android.usesPermissions.useGoogleServicesJson (boolean)

2-

ERROR: network: network request failed: gs://myApp.appspot.com/Icon-72.png [-1002: unsupported URL]

Here is my build.settings:

android = { usesPermissions = { "android.permission.INTERNET", useGoogleServicesJson = true, }, },

Here is my code to download the file:

local urlForImage = "gs://myApp.appspot.com/Icon-72.png" network.download( urlForImage, "GET", function(e) if (e.isError == false) then local displayDownload = display.newImageRect("Icon-72.png", system.TemporaryDirectory, 50, 50 ) displayDownload.x, displayDownload.y =display.contentCenterX, display.contentCenterY+50 print("Download Succesful") end end, "Icon-72.png", system.TemporaryDirectory )

I did include the google-services.json file in the root folder. 

gs://myApp.appspot.com/Icon-72.png is not a valid URL, you need valid URL for example

is not a valid URL 

gs://scott-h-tech-b9dc2.appspot.com/crate.png

but this is

https://firebasestorage.googleapis.com/v0/b/scott-h-tech-b9dc2.appspot.com/o/crate.png?alt=media&token=52d445b3-b011-449f-a26a-3f131533ceac

you need to use the firebaseStorage.getDownloadURL() function to get the URL dynamically. 

I did change the URL and it worked. But, I have a question:

From your docs:

firebaseStorage.getDownloadURL(pathInFirebase, listener) pathInFirebase(string) where you want to get file url in firebase

If it’s supposed to get the URL dynamically then, what exactly am I supposed to provide in the “pathInFirebase” parameter? 

The path param allows you to grab a file from storage. For example 

If I want this file

Screen_Shot_2017_10_13_at_10_42_49_AM.pn

I would use “crate.png”

If I want this file

Screen_Shot_2017_10_13_at_10_44_28_AM.pn

I would use “testFolder/crate.png”

I created a folder in my Firebase project and inserted the file into it. Here is the code:

firebaseStorage.getDownloadURL ("TestFolder/Icon-72.png", function(e) if (e.isError == false) then urlForImage = e.downloadURL print("URL Exists") else print( e.error ) end end )

It gets me nothing. Doesn’t even print an error

Are you using simulator? Firebase storage is only supported on iOS and Android.

I’m getting this error after launching the app on my Android device, check my original post for build.settings:

HqkBXq2.png

Here is how I initialize

local firebaseStorage = require ( "plugin.firebaseStorage" ) firebaseStorage.init("gs://myApp.appspot.com") 

Firebase:

You don’t need to set bucket unless you are on a paid plan

it is just 

firebaseStorage.init()

Now it says:

Default FirebaseApp is not initialized in this process com.myCompany.myApp make sure to call FirebaseApp.initializeApp(Context) first

Note that “com.myCompany.myApp” is the same in my Firebase project as in the corona build settings.

I don’t know man, too many problems for such a simple task. Maybe firebase is not the right solution for me. 

I may have miss spoke about init, you were doing it right but you should use a timer

Please look at the sample if you are having trouble
https://github.com/scottrules44/firebaseStorage-demo

I also got error firebassStorage plugin Corona build (3184).

Always happen in launch and it said below.

 

IlligalStateException:Dafault FirebaseApp is not initialized in this process com.mycompany.myapp.

Make sure to call Firebase App, initializeApp(Context)first.