【发布时间】:2020-09-22 17:34:15
【问题描述】:
我能够构建和运行这个应用,但是当收到 Firebase 消息时,应用崩溃了:
java.lang.RuntimeException: Unable to create service com.myapp.MyFirebaseMessagingService:
java.lang.ClassNotFoundException:
Didn't find class "com.myapp.MyFirebaseMessagingService" on path: DexPathList[[zip file "/data/app/~~SctCMq9gW9e2EQFxhI0GiA==/com.myapp-Dt1ZpS77Njywg1USKxic5Q==/base.apk", zip file "/data/app/~~SctCMq9gW9e2EQFxhI0GiA==/com.myapp-Dt1ZpS77Njywg1USKxic5Q==/split_config.en.apk", zip file "/data/app/~~SctCMq9gW9e2EQFxhI0GiA==/com.myapp-Dt1ZpS77Njywg1USKxic5Q==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/~~SctCMq9gW9e2EQFxhI0GiA==/com.myapp-Dt1ZpS77Njywg1USKxic5Q==/lib/x86, /system/lib, /system_ext/lib, /product/lib]]
在 AndroidManifest.xml 我有:
<service
android:name=".MyFirebaseMessagingService"
android:exported="false"
tools:ignore="MissingClass">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
MyFirebaseMessagingService.kt 存在于src/main/java/com/myapp/ 目录下。
(虽然路径中的这个 java 很可疑,但它是由 Android Studio 生成的。)
我错过了什么?
【问题讨论】:
标签: android firebase kotlin service firebase-cloud-messaging