当我尝试在 Android Kitkat 4.4.4 中启动时应用程序崩溃但在 Android 5 和 6 版本中运行正常
App crashes when I try to launch in Android Kitkat 4.4.4 but works fine in Android 5 & 6 versions
我是 android
的新手,我无法理解这里到底发生了什么,应用程序工作正常 Android
5 & 6 但在Android
4(KITKAT
)
03-13 13:11:44.925 10802-10840/? E/GoogleConversionPing: Error sending ping 03-13 13:11:45.145 3289-3497/? E/NetworkScheduler.SR: Invalid parameter app 03-13 13:11:45.145 3289-3497/? E/NetworkScheduler.SR: Invalid package name : Perhaps you didn't include a PendingIntent in the extras? 03-13 13:11:45.228 10802-10802/? E/WifiManager: mWifiServiceMessenger == null 03-13 13:11:46.710 650-650/? E/RemoteViews: ANR Warning,RemoteViews can only be used once ,if not ,it may cause ANR in hosts such as Laucher,SystemUI. keys for search <ANR Exception MSG History> 03-13 13:11:46.741 650-650/? E/NotificationService: unable to notify listener (posted): android.service.notification.INotificationListener$Stub$Proxy@4249a880
android.os.DeadObjectException
at android.os.BinderProxy.transact(Native Method)
at android.service.notification.INotificationListener$Stub$Proxy.onNotificationPosted(INotificationListener.java:102)
at com.android.server.NotificationManagerService$NotificationListenerInfo.notifyPostedIfUserMatch(NotificationManagerService.java:264)
at com.android.server.NotificationManagerService.run(NotificationManagerService.java:837)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at com.android.server.ServerThread.initAndLoop(SystemServer.java:1447)
at com.android.server.SystemServer.main(SystemServer.java:1542)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(Native Method) 03-13 13:11:53.368 650-1010/? E/CellLocation: create GsmCellLocation 03-13 13:11:53.398 650-650/? E/CellLocation: create GsmCellLocation 03-13 13:11:53.608 650-825/? E/CellLocation: create GsmCellLocation 03-13 13:11:53.636 650-650/? E/CellLocation: create GsmCellLocation 03-13 13:12:01.735 650-650/? E/RemoteViews: ANR Warning,RemoteViews can only be used once ,if not ,it may cause ANR in hosts such as Laucher,SystemUI. keys for search <ANR Exception MSG History> 03-13 13:12:01.743 650-650/? E/NotificationService: unable to notify listener (posted): android.service.notification.INotificationListener$Stub$Proxy@4249a880
android.os.DeadObjectException
at android.os.BinderProxy.transact(Native Method)
at android.service.notification.INotificationListener$Stub$Proxy.onNotificationPosted(INotificationListener.java:102)
at com.android.server.NotificationManagerService$NotificationListenerInfo.notifyPostedIfUserMatch(NotificationManagerService.java:264)
at com.android.server.NotificationManagerService.run(NotificationManagerService.java:837)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at com.android.server.ServerThread.initAndLoop(SystemServer.java:1447)
at com.android.server.SystemServer.main(SystemServer.java:1542)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(Native Method)
编辑:OP 改变了问题,因为它被回答了,所以这个答案没有
不再申请。
class android.app.job.JobScheduler
已添加到 API 级别 21 (Android 5.0)。因此很明显,该应用程序会在较早的 Android 版本上崩溃。
JobScheduler
未向后移植,但是,Firebase JobDispatcher 支持相同的 API 并通过 Google Play Services
.
向后移植
The Firebase JobDispatcher is a library for scheduling background jobs
in your Android app. It provides a JobScheduler-compatible API that
works on all recent versions of Android (API level 9+) that have
Google Play services installed.
**If your minSdkVersion is set to 21 or higher, all you need to do is set multiDexEnabled to true in your module-level build.gradle file, as shown here:**
android {
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 25
multiDexEnabled true
}``
...
}
依赖项{编译'com.android.support:multidex:1.0.1'}
public class MyApplication extends MultiDexApplication { ... }
Application extends SomeOtherApplication { @Override protected
void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this); } }
我是 android
的新手,我无法理解这里到底发生了什么,应用程序工作正常 Android
5 & 6 但在Android
4(KITKAT
)
03-13 13:11:44.925 10802-10840/? E/GoogleConversionPing: Error sending ping 03-13 13:11:45.145 3289-3497/? E/NetworkScheduler.SR: Invalid parameter app 03-13 13:11:45.145 3289-3497/? E/NetworkScheduler.SR: Invalid package name : Perhaps you didn't include a PendingIntent in the extras? 03-13 13:11:45.228 10802-10802/? E/WifiManager: mWifiServiceMessenger == null 03-13 13:11:46.710 650-650/? E/RemoteViews: ANR Warning,RemoteViews can only be used once ,if not ,it may cause ANR in hosts such as Laucher,SystemUI. keys for search <ANR Exception MSG History> 03-13 13:11:46.741 650-650/? E/NotificationService: unable to notify listener (posted): android.service.notification.INotificationListener$Stub$Proxy@4249a880
android.os.DeadObjectException
at android.os.BinderProxy.transact(Native Method)
at android.service.notification.INotificationListener$Stub$Proxy.onNotificationPosted(INotificationListener.java:102)
at com.android.server.NotificationManagerService$NotificationListenerInfo.notifyPostedIfUserMatch(NotificationManagerService.java:264)
at com.android.server.NotificationManagerService.run(NotificationManagerService.java:837)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at com.android.server.ServerThread.initAndLoop(SystemServer.java:1447)
at com.android.server.SystemServer.main(SystemServer.java:1542)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(Native Method) 03-13 13:11:53.368 650-1010/? E/CellLocation: create GsmCellLocation 03-13 13:11:53.398 650-650/? E/CellLocation: create GsmCellLocation 03-13 13:11:53.608 650-825/? E/CellLocation: create GsmCellLocation 03-13 13:11:53.636 650-650/? E/CellLocation: create GsmCellLocation 03-13 13:12:01.735 650-650/? E/RemoteViews: ANR Warning,RemoteViews can only be used once ,if not ,it may cause ANR in hosts such as Laucher,SystemUI. keys for search <ANR Exception MSG History> 03-13 13:12:01.743 650-650/? E/NotificationService: unable to notify listener (posted): android.service.notification.INotificationListener$Stub$Proxy@4249a880
android.os.DeadObjectException
at android.os.BinderProxy.transact(Native Method)
at android.service.notification.INotificationListener$Stub$Proxy.onNotificationPosted(INotificationListener.java:102)
at com.android.server.NotificationManagerService$NotificationListenerInfo.notifyPostedIfUserMatch(NotificationManagerService.java:264)
at com.android.server.NotificationManagerService.run(NotificationManagerService.java:837)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at com.android.server.ServerThread.initAndLoop(SystemServer.java:1447)
at com.android.server.SystemServer.main(SystemServer.java:1542)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(Native Method)
编辑:OP 改变了问题,因为它被回答了,所以这个答案没有 不再申请。
class android.app.job.JobScheduler
已添加到 API 级别 21 (Android 5.0)。因此很明显,该应用程序会在较早的 Android 版本上崩溃。
JobScheduler
未向后移植,但是,Firebase JobDispatcher 支持相同的 API 并通过 Google Play Services
.
The Firebase JobDispatcher is a library for scheduling background jobs in your Android app. It provides a JobScheduler-compatible API that works on all recent versions of Android (API level 9+) that have Google Play services installed.
**If your minSdkVersion is set to 21 or higher, all you need to do is set multiDexEnabled to true in your module-level build.gradle file, as shown here:**
android {
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 25
multiDexEnabled true
}``
...
}
依赖项{编译'com.android.support:multidex:1.0.1'}
public class MyApplication extends MultiDexApplication { ... }
Application extends SomeOtherApplication { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); } }