Why does PhoneGap only create "HelloWorld" when I build for iOS?

444 views
Skip to first unread message

Aero Windwalker

unread,
Apr 1, 2014, 10:05:55 AM4/1/14
to phon...@googlegroups.com
Hi, I am running 3.4.0 from terminal, here is what I do:

cd /phonegap
phonegap create customname com.mywebsite.customname 
phonegap install ios com.mywebsite.customname customname
phonegap build ios com.mywebsite.customname customname

And I get a "HelloWorld" folder inside my platforms/ios/ folder.

Is this common or did I do something wrong? 

Abhinay Maurya

unread,
Apr 2, 2014, 5:15:20 AM4/2/14
to phon...@googlegroups.com
I'm facing the same issue on Android. Is something broken with 3.4.0?

jcesarmobile

unread,
Apr 2, 2014, 6:03:25 AM4/2/14
to phon...@googlegroups.com, abhin...@gmail.com
try

cd /phonegap
phonegap create customname com.mywebsite.customname customname

Greg Watson

unread,
Apr 9, 2014, 12:33:33 PM4/9/14
to phon...@googlegroups.com, abhin...@gmail.com
I'm using phonegap 3.4.0-0.19.11 on OS X Mavericks, and for me, changing the order of the arguments doesn't seem to make a difference.  Any time I use the name or id arguments per the Phonegap documentation (http://docs.phonegap.com/en/edge/guide_cli_index.md.html#The%20Command-Line%20Interface), I get an error like:
[phonegap] the options undefined ...

and the created project has the default "hello world" values.  This also happens if I use the explicit "-i" and "-n" or "--id" and "--name" options.  However, if I use the cordova command instead of phonegap, these options work just fine.  It seems like this is either a bug or something is wrong with my configuration.

Greg Watson

unread,
Apr 9, 2014, 3:21:10 PM4/9/14
to phon...@googlegroups.com, abhin...@gmail.com
After digging through some code, I've got a few more details on this issue.

The phonegap create command is somewhat of a shell that in turn calls the "cordova create" command.  It correctly parses and passes on both the "name" and "id" options. If you run this command

phonegap -d create my_test com.example.mytest MyTest

which uses the the -d (verbose) flag, it produces this output:

Creating a new cordova project with name "MyTest" and id "com.example.mytest" at location "/code/my_test"

However, the phonegap create code also passes along some path configuration options:

var self = this,
        version
= self.phonegap.version().phonegap,
        uri
= 'https://github.com/phonegap/phonegap-app-hello-world/archive/' +
              version
+ '.tar.gz';

   
// customize default app
    cordova
.config(options.path, {
        lib
: {
            www
: {
                id
: 'phonegap',
                version
: version,
                uri
: uri
           
}
       
}
   
});


In the cordova create command it sees these path config options and uses them to create the www subdirectory.  You can see this because the verbose flag also results in this output from the command above:


Later on in the cordova create.js code, there is this section:

        var configPath = util.projectConfig(dir);
       
// Add template config.xml for apps that are missing it
       
if (!fs.existsSync(configPath)) {
           
var template_config_xml = path.join(__dirname, '..', 'templates', 'config.xml');
            shell
.cp(template_config_xml, configPath);
           
// Write out id and name to config.xml
           
var config = new ConfigParser(configPath);
            config
.setPackageName(id);
            config
.setName(name);
            config
.write();
       
}

This is the chunk of code that would use the passed-in "id" and "name" values.  However, since the downloaded PhoneGap hello world file already contains a config.xml file, this code never executes and the new projects ends up ignoring your custom name and id.

Long story short, I'm not sure if the bug is in phonegap's create.js, cordova's creat.js or the documentation, but there is definitely a problem that needs to be fixed.

JP

unread,
Apr 21, 2014, 1:31:43 PM4/21/14
to phon...@googlegroups.com, abhin...@gmail.com
I second this. I also have this issue and no matter how I name it using the flags it will only create a helloworld app.

rahul

unread,
Apr 23, 2014, 11:35:04 AM4/23/14
to phon...@googlegroups.com, abhin...@gmail.com
What happens when you first create the project. Then before adding the platforms you modify id and name in the config.xml present in the www directory. I mean this part -

<!-- config.xml reference: https://build.phonegap.com/docs/config-xml -->
<widget xmlns     = "http://www.w3.org/ns/widgets"
        xmlns:gap = "http://phonegap.com/ns/1.0"
        id        = "com.example.test"
        version   = "1.0.0">

    <name>Test</name>

And then add the platforms after that.

JP

unread,
Apr 25, 2014, 12:58:52 PM4/25/14
to phon...@googlegroups.com, abhin...@gmail.com
Yeah, Rahul, this is exactly what I ended up doing, but not sure this is how it is supposed to work. Thanks.

Greg Watson

unread,
Apr 25, 2014, 3:43:26 PM4/25/14
to phon...@googlegroups.com, abhin...@gmail.com
Like JP, this does works for Android too.  Thanks for suggesting this workaround.


On Wednesday, April 23, 2014 8:35:04 AM UTC-7, rahul wrote:
Reply all
Reply to author
Forward
0 new messages