navigator.app.exitApp()崩溃上的PhoneGap 3.1.0 [英] navigator.app.exitApp() crashes on phonegap 3.1.0

查看:530
本文介绍了navigator.app.exitApp()崩溃上的PhoneGap 3.1.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次navigator.app.exitApp()被调用我的应用程序,应用程序是crashing.Kindly找到崩溃日志,我得到的下面。

Everytime navigator.app.exitApp() is called in my app ,the App is crashing.Kindly find below the crash log that I get.

01-09 13:20:24.556: E/AndroidRuntime(18767): FATAL EXCEPTION: main
01-09 13:20:24.556: E/AndroidRuntime(18767): java.lang.RuntimeException: Unable to       destroy activity {com.pixatel.mathwhiz/com.pixatel.mathwhiz.MathWhiz}:   java.lang.IllegalArgumentException: Receiver not registered: null
01-09 13:20:24.556: E/AndroidRuntime(18767):    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3294)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3312)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at android.app.ActivityThread.access$1200(ActivityThread.java:138)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1260)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at android.os.Handler.dispatchMessage(Handler.java:99)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at android.os.Looper.loop(Looper.java:213)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at android.app.ActivityThread.main(ActivityThread.java:4787)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at java.lang.reflect.Method.invokeNative(Native Method)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at java.lang.reflect.Method.invoke(Method.java:511)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at dalvik.system.NativeStart.main(Native Method)
01-09 13:20:24.556: E/AndroidRuntime(18767): Caused by: java.lang.IllegalArgumentException: Receiver not registered: null
01-09 13:20:24.556: E/AndroidRuntime(18767):    at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:654)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1165)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:378)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at org.apache.cordova.device.Device.onDestroy(Device.java:98)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at org.apache.cordova.PluginManager.onDestroy(PluginManager.java:326)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at org.apache.cordova.CordovaWebView.handleDestroy(CordovaWebView.java:833)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at org.apache.cordova.CordovaActivity.onDestroy(CordovaActivity.java:774)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at android.app.Activity.performDestroy(Activity.java:5172)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1109)
01-09 13:20:24.556: E/AndroidRuntime(18767):    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3281)

下code是我的主要活动文件: -

The Code below is my main activity file :-

public class MathWhiz extends CordovaActivity 
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.init();
        // Set by <content src="index.html" /> in config.xml
        super.loadUrl(Config.getStartUrl());

        //super.loadUrl("file:///android_asset/www/index_android.html");

        try {
            String pName = this.getClass().getPackage().getName();
            this.copy("Databases.db", "/data/data/" + pName + "/app_database/");
            this.copy("0000000000000001.db", "/data/data/" + pName
                    + "/app_database/file__0/");
        } catch (IOException e) {
            e.printStackTrace();
        }

       // super.loadUrl("file:///android_asset/www/index_android.html",3000);
    }

    void copy(String file, String folder) throws IOException {

        File CheckDirectory;
        CheckDirectory = new File(folder);
        if (!CheckDirectory.exists()) {
            CheckDirectory.mkdir();
        }

        InputStream in = getApplicationContext().getAssets().open(file);
        OutputStream out = new FileOutputStream(folder + file);

        // Transfer bytes from in to out
        byte[] buf = new byte[1024];
        int len;
        while ((len = in.read(buf)) > 0)
            out.write(buf, 0, len);
        in.close();
        out.close();

这个问题是不存在的PhoneGap的版本2.9.0.Started与3.1.0发生。
请让我知道什么是it.Thanks提前相关的问题。

This issue wasn't there in the phonegap version 2.9.0.Started happening with 3.1.0. Please let me know what is the issue associated with it.Thanks in advance.

推荐答案

据该<一个href=\"https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-device.git;a=blob;f=src/android/Device.java;h=2ce3cc73dbc6df7d6b382c1cd8bde13b35ebced8;hb=2d0c783beea770d36d5df86d5e3e45039cd16876\"相对=nofollow>文件设备插件注册一个接收器监听电话的行为。因此,请确保您已添加所需的权限,使电话工作的Andr​​oid.Manifest.xml文件。

According to that file the Device plugin registers a receiver to listen for Telephony actions. So make sure that you have added the required permissions to make Telephony work in the Android.Manifest.xml file.

这篇关于navigator.app.exitApp()崩溃上的PhoneGap 3.1.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆