grunt-phonegap icon indicating copy to clipboard operation
grunt-phonegap copied to clipboard

grunt phonegap:build places platforms and plugins in wrong directories

Open jcwilson opened this issue 10 years ago • 9 comments

When running this command it adds the plugins and platforms to:

<project-root>/plugins
<project-platform>/plugins

not to

<project-root>/<config:path>/plugins
<project-root>/<config:path>/plugins

This causes the "phonegap build" step to fail with: Fatal error: Unable to read "phonegap/platforms/android/AndroidManifest.xml" file (Error code: ENOENT).

However, the file is present at "platforms/android/AndroidManifest.xml".

Relevant version info: [email protected] [email protected] [email protected] [email protected] [email protected]

    grunt.initConfig({

        phonegap: {
            config: {
                path: 'phonegap',
                plugins: ['org.apache.cordova.console', 'org.apache.cordova.device', 'org.apache.cordova.statusbar'],
                platforms: ['android'],
            }
        }
    });

jcwilson avatar Apr 22 '14 02:04 jcwilson

I have encountered the same issue. The temporary workaround is to downgrade phonegap to version 3.3, because with older version everything works fine.

npm uninstalll phonegap
npm install [email protected]

wszymaniak avatar Apr 24 '14 12:04 wszymaniak

i am facing the same issue

simontseng avatar May 11 '14 18:05 simontseng

Thx @wszymaniak , I also had to remove the build directory:

npm -g uninstall phonegap
npm -g install [email protected] --save-dev
rm -r phonegap

jlebrijo avatar May 18 '14 10:05 jlebrijo

I have the same issue but downgrating to 3.3 version doesn't help. Does anybody has any solutions to fix it?

OlgaBielkina avatar Jun 02 '14 14:06 OlgaBielkina

did you remove phonegap directory ??

jlebrijo avatar Jun 02 '14 14:06 jlebrijo

I made: npm -g uninstall phonegap npm -g install [email protected] For now phonegap version is 3.3 and during teamCity build 3.3 version is used and reconfigure phonegap to another user folder I'm running this tasks on TeamCity image

OlgaBielkina avatar Jun 02 '14 15:06 OlgaBielkina

Issue resolved. It was problem with android-sdk

OlgaBielkina avatar Jun 02 '14 16:06 OlgaBielkina

I had a very similar issue, but it was ios and android related. It turned out to be related to how cordova-cli detects the parent dir, which was forcing the phonegap local build call to use app/platforms rather than app/config.path/platforms (same with pugins.)

While I don't know that it's backwards compatible (I'm very new to the cordova world) this change fixed the issue for me.

https://github.com/streamlinesocial/grunt-phonegap/commit/15e43bbcdcc797e3a7188bfc228ac6da0406c8d0

(I made a 2nd commit to update the tests per contrib instructions - and could even work to help make this backwards compatible if it helps.)

cburyta avatar Jun 17 '14 17:06 cburyta

@OlgaBielkina I have now investigated and fixed this issue so you can use latest phonegap. There is an existence check that looks for config.xml in the phonegap directory and then recurses upwards until it finds a better match. You can fix by copying it manually or by using my fork, which also includes all of the unmerged pull requests. There are a couple of tests failing but these are for code I've not updated. I will submit a pull request with my changes now.

levexis avatar Jan 04 '15 09:01 levexis