我已按照这些说明操作,以便我可以在我的应用程序中使用Firebase消息传送功能:https://www.youtube.com/watch?v=rq-Axj79iNo。不幸的是,当我在Firebase控制台的计算机上按“发送”时,我的应用程序立即崩溃。我得到这个错误:Firebase消息传递崩溃了我的应用程序?
04-24 18:43:02.847 21312-21351/com.thisIsMyApplicationId E/AndroidRuntime: FATAL EXCEPTION: pool-1-thread-1
Process: com.thisIsMyApplicationId, PID: 21312
java.lang.AbstractMethodError: abstract method "void com.google.firebase.iid.zzb.handleIntent(android.content.Intent)"
at com.google.firebase.iid.zzb$1.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
也许这可能是我的问题的原因:我的应用程序根本不需要任何许可。如果我想使用Firebase消息传递,是否需要权限?或者是别的什么。我该如何解决这个问题?
一些有用的文件:
的build.gradle在app目录:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.myApplicationId"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-messaging:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
的build.gradle在摇篮目录:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
至于其他,我加入谷歌服务。 json到我的应用程序目录。
除了这些文件,我没有更改任何其他文件。
我该如何解决上述问题?
请张贴您的Android端代码。具体来说,build.gradle文件和消息传递服务 –
@AL。有没有,希望你能帮助我。我不知道您的消息服务代码的含义。 –
嘿@ Get-JanSchaap。谢谢。我的意思是[FirebaseMessagingService]的代码(https://firebase.google.com/docs/reference/android/com/google/firebase/messaging/FirebaseMessagingService)。 :) –