嗨,在我的 phonegap android 应用程序中,我正在 webview 中加载 html 页面,并且我有一个关闭按钮来使用“navigator.app.exitApp();”关闭应用程序。当我尝试关闭应用程序时,我在 logcat 中遇到异常。请帮我解决这个问题。
这是我在 logcat 中的错误:
05-29 16:36:32.966: E/ActivityThread(2836): Activity com.app.MainActivity has leaked IntentReceiver org.apache.cordova.Device$1@48bb2ec0 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-29 16:36:32.966: E/ActivityThread(2836): android.app.IntentReceiverLeaked: Activity com.app.MainActivity has leaked IntentReceiver org.apache.cordova.Device$1@48bb2ec0 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-29 16:36:32.966: E/ActivityThread(2836): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher.<init>(ActivityThread.java:940)
05-29 16:36:32.966: E/ActivityThread(2836): at android.app.ActivityThread$PackageInfo.getReceiverDispatcher(ActivityThread.java:735)
05-29 16:36:32.966: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:865)
05-29 16:36:32.966: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiver(ContextImpl.java:852)
05-29 16:36:32.966: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiver(ContextImpl.java:846)
05-29 16:36:32.966: E/ActivityThread(2836): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:318)
05-29 16:36:32.966: E/ActivityThread(2836): at org.apache.cordova.Device.initTelephonyReceiver(Device.java:138)
05-29 16:36:32.966: E/ActivityThread(2836): at org.apache.cordova.Device.initialize(Device.java:63)
05-29 16:36:32.966: E/ActivityThread(2836): at org.apache.cordova.api.PluginEntry.createPlugin(PluginEntry.java:81)
05-29 16:36:32.966: E/ActivityThread(2836): at org.apache.cordova.api.PluginManager.getPlugin(PluginManager.java:258)
05-29 16:36:32.966: E/ActivityThread(2836): at org.apache.cordova.api.PluginManager.exec(PluginManager.java:215)
05-29 16:36:32.966: E/ActivityThread(2836): at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:44)
05-29 16:36:32.966: E/ActivityThread(2836): at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:221)
05-29 16:36:32.966: E/ActivityThread(2836): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:596)
05-29 16:36:32.966: E/ActivityThread(2836): at android.os.Handler.dispatchMessage(Handler.java:99)
05-29 16:36:32.966: E/ActivityThread(2836): at android.os.Looper.loop(Looper.java:123)
05-29 16:36:32.966: E/ActivityThread(2836): at android.app.ActivityThread.main(ActivityThread.java:4632)
05-29 16:36:32.966: E/ActivityThread(2836): at java.lang.reflect.Method.invokeNative(Native Method)
05-29 16:36:32.966: E/ActivityThread(2836): at java.lang.reflect.Method.invoke(Method.java:521)
05-29 16:36:32.966: E/ActivityThread(2836): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
05-29 16:36:32.966: E/ActivityThread(2836): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
05-29 16:36:32.966: E/ActivityThread(2836): at dalvik.system.NativeStart.main(Native Method)
05-29 16:36:32.989: E/ActivityThread(2836): Activity com.app.MainActivity has leaked IntentReceiver org.apache.cordova.Device$1@48c839a0 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-29 16:36:32.989: E/ActivityThread(2836): android.app.IntentReceiverLeaked: Activity com.app.MainActivity has leaked IntentReceiver org.apache.cordova.Device$1@48c839a0 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-29 16:36:32.989: E/ActivityThread(2836): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher.<init>(ActivityThread.java:940)
05-29 16:36:32.989: E/ActivityThread(2836): at android.app.ActivityThread$PackageInfo.getReceiverDispatcher(ActivityThread.java:735)
05-29 16:36:32.989: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:865)
05-29 16:36:32.989: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiver(ContextImpl.java:852)
05-29 16:36:32.989: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiver(ContextImpl.java:846)
05-29 16:36:32.989: E/ActivityThread(2836): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:318)
05-29 16:36:32.989: E/ActivityThread(2836): at org.apache.cordova.Device.initTelephonyReceiver(Device.java:138)
05-29 16:36:32.989: E/ActivityThread(2836): at org.apache.cordova.Device.initialize(Device.java:63)
05-29 16:36:32.989: E/ActivityThread(2836): at org.apache.cordova.api.PluginEntry.createPlugin(PluginEntry.java:81)
05-29 16:36:32.989: E/ActivityThread(2836): at org.apache.cordova.api.PluginManager.getPlugin(PluginManager.java:258)
05-29 16:36:32.989: E/ActivityThread(2836): at org.apache.cordova.api.PluginManager.exec(PluginManager.java:215)
05-29 16:36:32.989: E/ActivityThread(2836): at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:44)
05-29 16:36:32.989: E/ActivityThread(2836): at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:221)
05-29 16:36:32.989: E/ActivityThread(2836): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:596)
05-29 16:36:32.989: E/ActivityThread(2836): at android.os.Handler.dispatchMessage(Handler.java:99)
05-29 16:36:32.989: E/ActivityThread(2836): at android.os.Looper.loop(Looper.java:123)
05-29 16:36:32.989: E/ActivityThread(2836): at android.app.ActivityThread.main(ActivityThread.java:4632)
05-29 16:36:32.989: E/ActivityThread(2836): at java.lang.reflect.Method.invokeNative(Native Method)
05-29 16:36:32.989: E/ActivityThread(2836): at java.lang.reflect.Method.invoke(Method.java:521)
05-29 16:36:32.989: E/ActivityThread(2836): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
05-29 16:36:32.989: E/ActivityThread(2836): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
05-29 16:36:32.989: E/ActivityThread(2836): at dalvik.system.NativeStart.main(Native Method)
05-29 16:36:32.997: E/ActivityThread(2836): Activity com.app.MainActivity has leaked IntentReceiver org.apache.cordova.NetworkManager$1@48bc76c0 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-29 16:36:32.997: E/ActivityThread(2836): android.app.IntentReceiverLeaked: Activity com.app.MainActivity has leaked IntentReceiver org.apache.cordova.NetworkManager$1@48bc76c0 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-29 16:36:32.997: E/ActivityThread(2836): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher.<init>(ActivityThread.java:940)
05-29 16:36:32.997: E/ActivityThread(2836): at android.app.ActivityThread$PackageInfo.getReceiverDispatcher(ActivityThread.java:735)
05-29 16:36:32.997: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:865)
05-29 16:36:32.997: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiver(ContextImpl.java:852)
05-29 16:36:32.997: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiver(ContextImpl.java:846)
05-29 16:36:32.997: E/ActivityThread(2836): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:318)
05-29 16:36:32.997: E/ActivityThread(2836): at org.apache.cordova.NetworkManager.initialize(NetworkManager.java:110)
05-29 16:36:32.997: E/ActivityThread(2836): at org.apache.cordova.api.PluginEntry.createPlugin(PluginEntry.java:81)
05-29 16:36:32.997: E/ActivityThread(2836): at org.apache.cordova.api.PluginManager.getPlugin(PluginManager.java:258)
05-29 16:36:32.997: E/ActivityThread(2836): at org.apache.cordova.api.PluginManager.exec(PluginManager.java:215)
05-29 16:36:32.997: E/ActivityThread(2836): at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:44)
05-29 16:36:32.997: E/ActivityThread(2836): at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:221)
05-29 16:36:32.997: E/ActivityThread(2836): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:596)
05-29 16:36:32.997: E/ActivityThread(2836): at android.os.Handler.dispatchMessage(Handler.java:99)
05-29 16:36:32.997: E/ActivityThread(2836): at android.os.Looper.loop(Looper.java:123)
05-29 16:36:32.997: E/ActivityThread(2836): at android.app.ActivityThread.main(ActivityThread.java:4632)
05-29 16:36:32.997: E/ActivityThread(2836): at java.lang.reflect.Method.invokeNative(Native Method)
05-29 16:36:32.997: E/ActivityThread(2836): at java.lang.reflect.Method.invoke(Method.java:521)
05-29 16:36:32.997: E/ActivityThread(2836): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
05-29 16:36:32.997: E/ActivityThread(2836): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
05-29 16:36:32.997: E/ActivityThread(2836): at dalvik.system.NativeStart.main(Native Method)
05-29 16:36:33.005: E/ActivityThread(2836): Activity com.app.MainActivity has leaked IntentReceiver org.apache.cordova.NetworkManager$1@48c790b8 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-29 16:36:33.005: E/ActivityThread(2836): android.app.IntentReceiverLeaked: Activity com.app.MainActivity has leaked IntentReceiver org.apache.cordova.NetworkManager$1@48c790b8 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-29 16:36:33.005: E/ActivityThread(2836): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher.<init>(ActivityThread.java:940)
05-29 16:36:33.005: E/ActivityThread(2836): at android.app.ActivityThread$PackageInfo.getReceiverDispatcher(ActivityThread.java:735)
05-29 16:36:33.005: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:865)
05-29 16:36:33.005: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiver(ContextImpl.java:852)
05-29 16:36:33.005: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiver(ContextImpl.java:846)
05-29 16:36:33.005: E/ActivityThread(2836): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:318)
05-29 16:36:33.005: E/ActivityThread(2836): at org.apache.cordova.NetworkManager.initialize(NetworkManager.java:110)
05-29 16:36:33.005: E/ActivityThread(2836): at org.apache.cordova.api.PluginEntry.createPlugin(PluginEntry.java:81)
05-29 16:36:33.005: E/ActivityThread(2836): at org.apache.cordova.api.PluginManager.getPlugin(PluginManager.java:258)
05-29 16:36:33.005: E/ActivityThread(2836): at org.apache.cordova.api.PluginManager.exec(PluginManager.java:215)
05-29 16:36:33.005: E/ActivityThread(2836): at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:44)
05-29 16:36:33.005: E/ActivityThread(2836): at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:221)
05-29 16:36:33.005: E/ActivityThread(2836): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:596)
05-29 16:36:33.005: E/ActivityThread(2836): at android.os.Handler.dispatchMessage(Handler.java:99)
05-29 16:36:33.005: E/ActivityThread(2836): at android.os.Looper.loop(Looper.java:123)
05-29 16:36:33.005: E/ActivityThread(2836): at android.app.ActivityThread.main(ActivityThread.java:4632)
05-29 16:36:33.005: E/ActivityThread(2836): at java.lang.reflect.Method.invokeNative(Native Method)
05-29 16:36:33.005: E/ActivityThread(2836): at java.lang.reflect.Method.invoke(Method.java:521)
05-29 16:36:33.005: E/ActivityThread(2836): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
05-29 16:36:33.005: E/ActivityThread(2836): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
05-29 16:36:33.005: E/ActivityThread(2836): at dalvik.system.NativeStart.main(Native Method)
05-29 16:36:33.052: D/dalvikvm(2836): GC_FOR_MALLOC freed 6792 objects / 818640 bytes in 34ms
05-29 16:36:33.059: E/ActivityThread(2836): Activity com.app.MainActivity has leaked IntentReceiver org.apache.cordova.CordovaWebView$1@48bc7fa8 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-29 16:36:33.059: E/ActivityThread(2836): android.app.IntentReceiverLeaked: Activity com.app.MainActivity has leaked IntentReceiver org.apache.cordova.CordovaWebView$1@48bc7fa8 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-29 16:36:33.059: E/ActivityThread(2836): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher.<init>(ActivityThread.java:940)
05-29 16:36:33.059: E/ActivityThread(2836): at android.app.ActivityThread$PackageInfo.getReceiverDispatcher(ActivityThread.java:735)
05-29 16:36:33.059: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:865)
05-29 16:36:33.059: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiver(ContextImpl.java:852)
05-29 16:36:33.059: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiver(ContextImpl.java:846)
05-29 16:36:33.059: E/ActivityThread(2836): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:318)
05-29 16:36:33.059: E/ActivityThread(2836): at org.apache.cordova.CordovaWebView.setup(CordovaWebView.java:299)
05-29 16:36:33.059: E/ActivityThread(2836): at org.apache.cordova.CordovaWebView.<init>(CordovaWebView.java:157)
05-29 16:36:33.059: E/ActivityThread(2836): at java.lang.reflect.Constructor.constructNative(Native Method)
05-29 16:36:33.059: E/ActivityThread(2836): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
05-29 16:36:33.059: E/ActivityThread(2836): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
05-29 16:36:33.059: E/ActivityThread(2836): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
05-29 16:36:33.059: E/ActivityThread(2836): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
05-29 16:36:33.059: E/ActivityThread(2836): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
05-29 16:36:33.059: E/ActivityThread(2836): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-29 16:36:33.059: E/ActivityThread(2836): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-29 16:36:33.059: E/ActivityThread(2836): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:210)
05-29 16:36:33.059: E/ActivityThread(2836): at android.app.Activity.setContentView(Activity.java:1647)
05-29 16:36:33.059: E/ActivityThread(2836): at com.app.MainActivity.onCreate(MainActivity.java:108)
05-29 16:36:33.059: E/ActivityThread(2836): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-29 16:36:33.059: E/ActivityThread(2836): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2632)
05-29 16:36:33.059: E/ActivityThread(2836): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2684)
05-29 16:36:33.059: E/ActivityThread(2836): at android.app.ActivityThread.access$2300(ActivityThread.java:126)
05-29 16:36:33.059: E/ActivityThread(2836): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2038)
05-29 16:36:33.059: E/ActivityThread(2836): at android.os.Handler.dispatchMessage(Handler.java:99)
05-29 16:36:33.059: E/ActivityThread(2836): at android.os.Looper.loop(Looper.java:123)
05-29 16:36:33.059: E/ActivityThread(2836): at android.app.ActivityThread.main(ActivityThread.java:4632)
05-29 16:36:33.059: E/ActivityThread(2836): at java.lang.reflect.Method.invokeNative(Native Method)
05-29 16:36:33.059: E/ActivityThread(2836): at java.lang.reflect.Method.invoke(Method.java:521)
05-29 16:36:33.059: E/ActivityThread(2836): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
05-29 16:36:33.059: E/ActivityThread(2836): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
05-29 16:36:33.059: E/ActivityThread(2836): at dalvik.system.NativeStart.main(Native Method)
05-29 16:36:33.067: E/ActivityThread(2836): Activity com.app.MainActivity has leaked IntentReceiver org.apache.cordova.CordovaWebView$1@48bc48f0 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-29 16:36:33.067: E/ActivityThread(2836): android.app.IntentReceiverLeaked: Activity com.app.MainActivity has leaked IntentReceiver org.apache.cordova.CordovaWebView$1@48bc48f0 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-29 16:36:33.067: E/ActivityThread(2836): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher.<init>(ActivityThread.java:940)
05-29 16:36:33.067: E/ActivityThread(2836): at android.app.ActivityThread$PackageInfo.getReceiverDispatcher(ActivityThread.java:735)
05-29 16:36:33.067: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:865)
05-29 16:36:33.067: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiver(ContextImpl.java:852)
05-29 16:36:33.067: E/ActivityThread(2836): at android.app.ContextImpl.registerReceiver(ContextImpl.java:846)
05-29 16:36:33.067: E/ActivityThread(2836): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:318)
05-29 16:36:33.067: E/ActivityThread(2836): at org.apache.cordova.CordovaWebView.setup(CordovaWebView.java:299)
05-29 16:36:33.067: E/ActivityThread(2836): at org.apache.cordova.CordovaWebView.<init>(CordovaWebView.java:157)
05-29 16:36:33.067: E/ActivityThread(2836): at java.lang.reflect.Constructor.constructNative(Native Method)
05-29 16:36:33.067: E/ActivityThread(2836): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
05-29 16:36:33.067: E/ActivityThread(2836): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
05-29 16:36:33.067: E/ActivityThread(2836): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
05-29 16:36:33.067: E/ActivityThread(2836): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
05-29 16:36:33.067: E/ActivityThread(2836): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
05-29 16:36:33.067: E/ActivityThread(2836): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-29 16:36:33.067: E/ActivityThread(2836): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-29 16:36:33.067: E/ActivityThread(2836): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:210)
05-29 16:36:33.067: E/ActivityThread(2836): at android.app.Activity.setContentView(Activity.java:1647)
05-29 16:36:33.067: E/ActivityThread(2836): at com.app.MainActivity.onCreate(MainActivity.java:108)
05-29 16:36:33.067: E/ActivityThread(2836): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-29 16:36:33.067: E/ActivityThread(2836): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2632)
05-29 16:36:33.067: E/ActivityThread(2836): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2684)
05-29 16:36:33.067: E/ActivityThread(2836): at android.app.ActivityThread.access$2300(ActivityThread.java:126)
05-29 16:36:33.067: E/ActivityThread(2836): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2038)
05-29 16:36:33.067: E/ActivityThread(2836): at android.os.Handler.dispatchMessage(Handler.java:99)
05-29 16:36:33.067: E/ActivityThread(2836): at android.os.Looper.loop(Looper.java:123)
05-29 16:36:33.067: E/ActivityThread(2836): at android.app.ActivityThread.main(ActivityThread.java:4632)
05-29 16:36:33.067: E/ActivityThread(2836): at java.lang.reflect.Method.invokeNative(Native Method)
05-29 16:36:33.067: E/ActivityThread(2836): at java.lang.reflect.Method.invoke(Method.java:521)
05-29 16:36:33.067: E/ActivityThread(2836): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
05-29 16:36:33.067: E/ActivityThread(2836): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
05-29 16:36:33.067: E/ActivityThread(2836): at dalvik.system.NativeStart.main(Native Method)