0

so I am trying to use the Firebase storage, and when I copied and pasted these lines of code in dependencies:

compile 'com.google.firebase:firebase-storage:9.2.0'
compile 'com.google.firebase:firebase-auth:9.2.0'

I get a build error that states:

Error:(33, 13) Failed to resolve: com.google.firebase:firebase-storage:9.2.0 Show in File
Show in Project Structure dialog

AND

Error:Failed to resolve: com.google.firebase:firebase-core:9.2.0 Open File
Show in Project Structure dialog

and

Error:(34, 13) Failed to resolve: com.google.firebase:firebase-auth:9.2.0 Show in File
Show in Project Structure dialog

Here is what my dependencies look like.

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.0.0-beta1'
    compile 'com.android.support:design:24.0.0-beta1'
    compile 'com.firebase:firebase-client-android:2.3.1'
    compile 'com.firebaseui:firebase-ui:0.3.1'
    compile 'com.google.firebase:firebase-storage:9.2.0'
    compile 'com.google.firebase:firebase-auth:9.2.0'
}
apply plugin: 'com.google.gms.google-services'

Also, what is the difference between Firebase database and firebase storage? when would you use one over the other, dont they both store information for you?

Devid Farinelli
  • 7,514
  • 9
  • 42
  • 73
TheQ
  • 1,949
  • 10
  • 38
  • 63
  • I think the `com.firebase:` beginning dependencies are deprecated now that Google owns firebase (compare the last two dependencies). Because they are above the latest ones, it may cause an error. Database is a database - you can store primitive data types there. The storage is more like a "cloud" - you can upload images, media, etc. – yennsarah Jul 11 '16 at 13:06
  • Do you have the Google Play Services installed in the SDK Manager? – LordRaydenMK Jul 11 '16 at 13:07
  • @LordRaydenMK Yeah i do, but maybe i need to update them? is that the only possible solution? – TheQ Jul 11 '16 at 13:10
  • On where to store what kind of data, see: http://stackoverflow.com/questions/37482907/firebase-differences-between-realtime-database-and-file-storage/37483948#37483948 – Frank van Puffelen Jul 11 '16 at 14:44
  • @LordRaydenMK I updated my SDK manager, but still no luck :/ I can't seem to use Firebase database... – TheQ Jul 12 '16 at 06:43

1 Answers1

1

Have you followed our getting started instructions? It's possible that you're missing the plugin that helps resolve these deps.

You're also going to want to remove the lines:

compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.firebaseui:firebase-ui:0.3.1'

and replace them with the upgraded versions:

compile 'com.google.firebase:firebase-database:9.2.0'
compile 'com.firebaseui:firebase-ui:0.4.2'

As for the difference between Firebase Database and Firebase Storage, the Firebase documentation says this:

  • The Firebase Realtime Database stores JSON application data, like game state or chat messages, and synchronizes changes instantly across all connected devices.

  • Firebase Remote Config stores developer-specified key-value pairs to change the behavior and appearance of your app without requiring users to download an update.

  • Firebase Hosting hosts the HTML, CSS, and JavaScript for your website as well as other developer-provided assets like graphics, fonts, and icons.

  • Firebase Storage stores files such as images, videos, and audio as well as other user-generated content.

Community
  • 1
  • 1
Mike McDonald
  • 15,609
  • 2
  • 46
  • 49
  • Hey Mike, thanks for the reply. So when I replaced: compile 'com.google.firebase:firebase-storage:9.2.0' and compile 'com.google.firebase:firebase-auth:9.2.0' with compile 'com.google.firebase:firebase-storage:9.0.1' compile 'com.google.firebase:firebase-auth:9.0.1' it worked. So does that mean it was just my android studio needing more updates for your code snipets to work? – TheQ Jul 12 '16 at 07:24
  • Also your definitions helped clarify my confusion. So thanks for that also. – TheQ Jul 12 '16 at 07:25