Esri / quickstart-map-phonegap

ArcGIS JavaScript samples for use with PhoneGap/Cordova
35 stars 37 forks source link

Issues with Cordova 3.5 #2

Closed andygup closed 9 years ago

andygup commented 10 years ago

This is more of a general "be aware" notification.

We've seen issues with several installations using Cordova 3.5 and running the quick start samples. Some (all?) of these are related to undocumented internal changes on how Cordova reads its configuration information when the application is starting up.

We had zero problems with Cordova 3.3 and previous versions, didn't do any testing on 3.4.

Errors may include:

  1. I/chromium( 934): [INFO:CONSOLE(52)] "Uncaught ReferenceError: require is not defined",
  2. A bunch of errors showing up in the console at runtime even though the mapping application is working fine.
  3. File not found errors, referring to the html file that you are using to launch your mapping app.

For now, without additional information, my recommendation is the following:

  1. If you have a choice, don't upgrade to Cordova 3.5 just yet unless you absolute have to.
  2. Be sure to copy all the HTML, JavaScript and CSS files from this repo and overwrite the /www directory in your Cordova/PhoneGap project.
  3. If that still doesn't work, change your main file name to index.html.
  4. If that still doesn't work then make the following code change to your main .java application file. It should be the only .java file in the project's source directory:
package com.ag.test;

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

public class MapTest extends CordovaActivity 
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.init();
        // Set by <content src="index.html" /> in config.xml
        // NOTE: comment out the line containing Config.getStartUrl()
        //super.loadUrl(Config.getStartUrl());

        //Uncomment the line below and tell it exactly which html file is your start file.
        super.loadUrl("file:///android_asset/www/index_basicmap.html");
    }
}

We will continue investigating this and post updates where applicable.

andygup commented 9 years ago

If this reappears we can reopen.