Android Firebase InstanceId:绑定到服务失败:Kotlin
应用程序已成功启动,但在调试中收到此错误消息。FirebaseInstanceId:绑定到服务失败 应用程序构建梯度:Android Firebase InstanceId:绑定到服务失败:Kotlin,android,firebase,kotlin,Android,Firebase,Kotlin,应用程序已成功启动,但在调试中收到此错误消息。FirebaseInstanceId:绑定到服务失败 应用程序构建梯度: android { compileSdkVersion 29 buildToolsVersion "29.0.2" defaultConfig { applicationId "" minSdkVersion 16 targetSdkVersion 29 versionCode 1 versionName "1.0" testIn
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId ""
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true // enable mun
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Android清单:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".FilterPage"></activity>
<activity android:name=".filterdashboard" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
我下载了最新版本的
google service.json
(可以通过Firebase设置完成)。在我的例子中,oauth\u客户端
中添加了一个新条目。与文件系统同步并重建我的应用程序后,警告似乎不再出现
编辑20-02-2020:在进行了更多的测试之后,不幸的是,最终似乎没有什么帮助。在我的情况下,只有在卸载应用程序后第一次启动应用程序时才会出现错误消息-在大多数其他情况下不会出现错误消息。请尝试使用实际设备。根据我的观察,即使您已经下载了与Google服务相关的所有必需库,但在使用模拟器时也会出现这种错误。我还可以从FirebaseInstanceId中看到其他错误。在我的例子中,登录到Google Play on emulator(API:R)修复了这个问题。我想这是关于游戏服务的。我已经添加了
<uses-permission android:name="android.permission.INTERNET"/>
在我的清单文件中,删除了Firebase InstanceId:绑定到服务失败。希望能有所帮助。在应用程序标记中添加服务标记
<application>
....
<activity
....
</activity>
<service
android:name=".MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
手动卸载应用程序并重新安装。这会有用的。不过这一个很奇怪。“绑定到服务失败”在我之前并没有出现,并且在几天后突然出现,即使我在没有此许可的情况下测试了相同的功能。对这种行为有什么想法吗?
import com.google.firebase.messaging.FirebaseMessagingService;
public class MyFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onNewToken(String s) {
super.onNewToken(s);
System.out.println("NEW_TOKEN :::::::::::::::::::::::::: "+s);
}
}