Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap Android: Unknown chromium error: -6

I'm creating a Phonegap Android app and I'm having trouble when adding a plugin to it. Cordova version is 2.2.0. I'm not using jQM or Sencha Touch. I test the app on Android 4.0.

The plugin I refer to is Android Phonegap plugin. This is my index.html file:

<!DOCTYPE html>
<html>
  <head>
    ...
  </head>
  <body>
    <div class="wrapper">
      ...
    </div>

    <script type="text/javascript" src="vendor/cordova-2.2.0.js"></script>
    <script type="text/javascript" src="assets/application.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
    <script type="text/javascript" src="js/datePickerPlugin.js"></script>
  </body>
</html>

This is my main Java file:

import android.app.Activity;
import android.os.Bundle;
import org.apache.cordova.*;

public class looker extends DroidGap
    {
        @Override
        public void onCreate(Bundle savedInstanceState)
            {
                super.onCreate(savedInstanceState);
                super.setIntegerProperty("splashscreen", R.drawable.splash);
                super.loadUrl("file:///android_asset/www/index.html", 7000);
            }
    }

So in order to understand if the problem is within the plugin, I minimized this file in assets/application.js where all my minimized scripts I use are. I removed the script tag for the plugin from index.html and the plugin was working just fine! So it's got something to do with the URL's maybe?

What have I tried so far?

I was researching a lot and tried several solutions to other similar problems.

  1. Made sure I have 3 /'s for the loadUrl in my main class:

    public void onCreate(Bundle savedInstanceState)
        {
          super.onCreate(savedInstanceState);
          super.setIntegerProperty("splashscreen", R.drawable.splash);
          super.loadUrl("file:///android_asset/www/index.html", 7000);
        }
    

    Had that from the very beginning, didn't make any difference.

  2. Tried calling super.init() before super.loadUrl(). Didn't work as well.

  3. Tried this:

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.init();
        super.setIntegerProperty("loadUrlTimeoutValue", 6000);
        super.loadUrl("file:///android_asset/www/index.html");
    }
    

    Still not fixing the problem.

  4. Checked if the file is loaded in the app, by adding an alert();. It loads.

That's in general. Will be glad to provide you with additional info if needed in order to resolve this issue. Thanks in advance!

like image 202
abpetkov Avatar asked Oct 22 '22 12:10

abpetkov


1 Answers

I followed the guide and was able to get the plugin working just fine.

However, I was able to replicate the "Unknown chromium error: -6" when I had this in my config.xml:

<plugin name="DatePickerPlugin1" value="com.phonegap.plugin.DatePickerPlugin"/>

Make sure that the "name" attribute in the XML is DatePickerPlugin, since that is the name that the JavaScript code uses for the plugin: https://github.com/phonegap/phonegap-plugins/blob/master/Android/DatePicker/datePickerPlugin.js#L33

There may be other ways to generate the same error though. If this doesn't help, can you post or link to your HTML file that actually calls out to this plugin, as well as your config.xml? (Make sure you are using a res/xml/config.xml and not res/xml/plugins.xml which has been deprecated here: http://cordova.apache.org/docs/en/2.0.0/guide_upgrading_android_index.md.html#Upgrading%20Cordova%20Android

like image 105
MBillau Avatar answered Nov 03 '22 02:11

MBillau