Android FirebaseAuth.getInstance()为空
我更新了Android FirebaseAuth.getInstance()为空,android,firebase,firebase-authentication,google-authentication,Android,Firebase,Firebase Authentication,Google Authentication,我更新了com.google.firebase:firebase core:16.0.7和com.google.firebase:firebase auth:16.1.0,但我没有更改代码中的任何内容,现在FirebaseAuth.getInstance()为空 java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.auth.FirebaseUser com.google.fir
com.google.firebase:firebase core:16.0.7
和com.google.firebase:firebase auth:16.1.0
,但我没有更改代码中的任何内容,现在FirebaseAuth.getInstance()
为空
java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.auth.FirebaseUser com.google.firebase.auth.FirebaseAuth.getCurrentUser()' on a null object reference
我想检查用户是否已登录
FirebaseAuth.getInstance().getCurrentUser()
我在Gradle同步时收到这些错误(但已成功完成):
我检查了github firebase android sdk的问题,它们表明包括firebase auth 16.0.5确实解决了这个问题 您可以在此处阅读完整的问题信息:
让我知道它是否有效 我找到了这个错误的原因。由于依赖关系,我将
tools:node=“replace”
添加到我的AndroidManifest.xml中。当我把它取下来时,一切又恢复正常了
我找到了这个错误的原因。我将工具:node=“replace”添加到 由于依赖关系,我的AndroidManifest.xml被删除。当我把它全部移除时 工作又很好了 我也有同样的问题,约翰尼斯的解决方案对我很有效。我从AndroidManifest.xml中删除了tools:node=“replace”,还删除了 实现'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1' 来自gradle,与工具关联:node=“replace”
................................
我也有同样的问题FirebaseApp.InitializeApp(Application.Context)
始终为空
尝试了谷歌的所有指令,但都不起作用
然后我一个接一个地移除了所有与Firebase相关的nuget内容。
仅保留Xamarin.Firebase.Auth
它工作得很好。试试看
注意:
- 如果我再次添加
,它将返回null。所以,我猜这个裸体有点不对劲Xamarin.Firebase.Config
您能否提供一些关于错误的代码?通过代码支持您的问题我只想检查用户是否使用FirebaseAuth登录。getInstance()。getCurrentUser()提供完整的代码以获得最佳帮助哪种代码?除了登录,我再也不做了。现在我使用com.google.firebase:firebase auth:16.0.5,我得到了同样的错误。我用gradly syncMy good的一些错误更新了我的问题。这确实做到了。到处都找过了,直到现在都没有运气。我没有这条线。我添加了
tools:node=“merge”
,然后我的问题就解决了!。谢谢
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="RushWay"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:node="replace">
<activity android:name=".Home">
<intent-filter> ................................