正在开发我添加许可的应用程序。我的应用程序适用于果冻豆4.1不适用于果冻豆4.2及以上。当我从另一个移动设备发送消息以激活许可时,应用程序没有在软糖豆4.2及以上版本中获取消息,但它在4.1中工作正常。现在我使用调试器在Android设备上运行我的应用程序,它显示以下错误。请帮我解决这个问题。提前谢谢。
这是我的logcat错误:
04-08 10:12:17.201: I/LOG(15378): JJ/data/data/com.commonsware.android.syssvc.alarm/files
04-08 10:12:17.202: I/s(15378): File decryptted:
04-08 10:12:17.202: I/File(15378): File contents:
04-08 10:12:17.203: I/s(15378): File decryptted:
04-08 10:12:17.203: I/File(15378): File contents:
04-08 10:12:17.203: I/log(15378): mainclassfalse
04-08 10:12:17.210: W/IInputConnectionWrapper(15378): beginBatchEdit on inactive InputConnection
04-08 10:12:17.210: W/IInputConnectionWrapper(15378): endBatchEdit on inactive InputConnection
04-08 10:12:17.220: E/ActivityThread(15378): Activity com.commonsware.android.syssvc.alarm.MainActivity has leaked IntentReceiver com.commonsware.android.syssvc.alarm.MainActivity$1@421e1de8 that was originally registered here. Are you missing a call to unregisterReceiver()?
04-08 10:12:17.220: E/ActivityThread(15378): android.app.IntentReceiverLeaked: Activity com.commonsware.android.syssvc.alarm.MainActivity has leaked IntentReceiver com.commonsware.android.syssvc.alarm.MainActivity$1@421e1de8 that was originally registered here. Are you missing a call to unregisterReceiver()?
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:805)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:606)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1551)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1531)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1525)
04-08 10:12:17.220: E/ActivityThread(15378): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:467)
04-08 10:12:17.220: E/ActivityThread(15378): at com.commonsware.android.syssvc.alarm.MainActivity.onCreate(MainActivity.java:99)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.Activity.performCreate(Activity.java:5248)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3819)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ActivityThread.access$900(ActivityThread.java:139)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1216)
04-08 10:12:17.220: E/ActivityThread(15378): at android.os.Handler.dispatchMessage(Handler.java:102)
04-08 10:12:17.220: E/ActivityThread(15378): at android.os.Looper.loop(Looper.java:136)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ActivityThread.main(ActivityThread.java:5102)
04-08 10:12:17.220: E/ActivityThread(15378): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 10:12:17.220: E/ActivityThread(15378): at java.lang.reflect.Method.invoke(Method.java:515)
04-08 10:12:17.220: E/ActivityThread(15378): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
04-08 10:12:17.220: E/ActivityThread(15378): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-08 10:12:17.220: E/ActivityThread(15378): at dalvik.system.NativeStart.main(Native Method)
04-08 10:12:17.235: I/log(15378): 111111111111111111111111111111z111111111111111
04-08 10:12:17.254:I / log(15378):111111111111111111111111111111111111111111111
答案 0 :(得分:0)
正如我在日志中看到的那样,您忘记取消注册广播接收器。尝试在MainActivity的unregisterReceiver(myBroadcastReceiver);
或onStop()
或onPause()
方法中添加代码onDestroy()
。
如果您已取消注册接收器,请尝试提前执行此操作。例如,如果您在onDestroy()
方法中取消注册,则将其移至onStop()
。或者,如果您在onStop()
取消注册,请将其移至onPause()