gpt4 book ai didi

android - firebase_messaging : ^4. 0.0+4 不工作

转载 作者:IT王子 更新时间:2023-10-29 07:03:33 25 4
gpt4 key购买 nike

错误:-

Java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.firebase.iid.FirebaseInstanceId.getToken()' on a null object reference

主build.gradle

dependencies { classpath 'com.android.tools.build:gradle:3.3.1' classpath 'com.google.gms:google-services:4.0.1' }

应用级build.gradle

dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation 'com.google.firebase:firebase-core:16.0.1' } apply plugin: 'com.google.gms.google-services'

Android.manifest.xml

<activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:largeHeap="true" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data android:name="io.flutter.app.android.SplashScreenUntilFirstFrame" android:value="true" />

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>

</activity>

最佳答案

我发现的主要问题是位置插件和 FCM 插件所需的谷歌服务版本不同。

在最底部的app级build.gradle文件

 dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1' }
apply plugin: 'com.google.gms.google-services' com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck
= true

关于android - firebase_messaging : ^4. 0.0+4 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55901030/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com