[英]Why is my application crashing on debug with Application stopped?
The build runs successfully but closes with notification "Application stopped" on my monitoring device.构建成功运行,但在我的监控设备上以通知“应用程序已停止”关闭。 I have the following errors in my logcat:我的 logcat 中有以下错误:
2020-05-07 08:57:47.729 22899-22899/? E/libc: Access denied finding property "persist.vendor.sys.activitylog"
2020-05-07 08:57:54.781 22899-22899/net.groupkse.indupendo E/MediaPlayerNative: stop called in state 1, mPlayer(0x0)
2020-05-07 08:57:54.781 22899-22899/net.groupkse.indupendo E/MediaPlayerNative: error (-38, 0)
2020-05-07 08:57:54.930 22899-22925/net.groupkse.indupendo E/libc: Access denied finding property "persist.vendor.log.tel_dbg"
2020-05-07 08:57:55.355 22899-22972/net.groupkse.indupendo E/libARC: item map does not been created yet!
2020-05-07 08:57:55.395 22899-22899/net.groupkse.indupendo E/MediaPlayer: Error (-38,0)
2020-05-07 08:57:55.412 22899-22899/net.groupkse.indupendo E/AndroidRuntime: FATAL EXCEPTION: main
Process: net.groupkse.indupendo, PID: 22899
android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null pri=0 contentView=null vibrate=null sound=null tick defaults=0x0 flags=0x42 color=0x00000000 actions=3 vis=PRIVATE)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1790)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6819)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:497)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:912)
Where could the issue be?问题可能出在哪里?
Have you registered your notification channel first by using createNotificationChannel
?您是否首先使用createNotificationChannel
注册了您的通知频道? Example code below, taken from the Android developer documentation :下面的示例代码取自Android 开发人员文档:
private void createNotificationChannel() {
// Create the NotificationChannel, but only on API 26+ because
// the NotificationChannel class is new and not in the support library
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence name = getString(R.string.channel_name);
String description = getString(R.string.channel_description);
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
channel.setDescription(description);
// Register the channel with the system; you can't change the importance
// or other notification behaviors after this
NotificationManager notificationManager = getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.