Firebase依赖未显示?

huangapple go评论70阅读模式
英文:

Firebase dependency isnt showing up?

问题

I've translated the non-code part of your text as requested:

所以我尝试将Firebase依赖项添加到我的Gradle项目中。但似乎不起作用。它可以成功添加,没有错误,我可以在“引用的库”中看到Firebase的jar文件。但每当我尝试导入任何内容,如import google.com.firebase,它都不显示。我做错了什么?这是我看到的唯一导入。

这是我的build.gradle中的repositories部分:

repositories {
    mavenCentral()
    google()
    jcenter()
}

这是我的dependencies部分:

dependencies {
    compile 'com.google.firebase:firebase-database:19.3.1'
}

基本上,我认为依赖项已正确添加,但我不知道为什么无法访问它?

顺便说一下,我不是在制作Android应用程序,而是在制作使用Forge Gradle的Minecraft模组。

此外,这是我的Gradle版本:https://services.gradle.org/distributions/gradle-4.1-all.zip

英文:

So I've tried adding Firebase dependency to my gradle project. But it doesn't seem to be working. It adds fine, there's no errors or anything and I can see the firebase jar in my Referenced Libraries. But whenever I try to import anything from it like import google.com.firebase, it doesn't show up. What am I doing wrong? These are the only imports I'm seeing.

Firebase依赖未显示?

This is my repositories thing in build.gradle

repositories {
    mavenCentral()
    google()
    jcenter()
}

This is my dependencies thing

dependencies {
    compile 'com.google.firebase:firebase-database:19.3.1'
}

So basically, the dependency adds correctly I think, it does show up on the Referenced libraries on my IDE but I don't know why I cannot access it?

Firebase依赖未显示?

Btw I'm not making an Android app, it's a mod for minecraft that uses forge gradle.

Also this is my gradle version: https://services.gradle.org/distributions/gradle-4.1-all.zip

答案1

得分: 0

因为我使用了专为Android开发者设计的带有aar扩展的依赖项,所以不是使用以下方式:

compile 'com.google.firebase:firebase-database:19.3.1'

而是使用以下方式,适用于Java的情况:

compile 'com.google.firebase:firebase-admin:6.16.0'
英文:

It was because i used an dependency meant for android developers with the aar extensions so instead of using

compile 'com.google.firebase:firebase-database:19.3.1'

In dependencies in build.gradle using this which is meant for the java thing works now.

compile 'com.google.firebase:firebase-admin:6.16.0'

huangapple
  • 本文由 发表于 2020年8月14日 03:43:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/63402212.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定