Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{ [CordovaError: Platform android already added] #97

Open
Ziv-Barber opened this issue Jun 26, 2014 · 3 comments
Open

{ [CordovaError: Platform android already added] #97

Ziv-Barber opened this issue Jun 26, 2014 · 3 comments

Comments

@Ziv-Barber
Copy link

I used these settings in my Gruntfile.js:

    phonegap: {
        config: {
            root: 'www',
            config: 'www/config.xml',
            cordova: '.cordova',
            html : 'index.html', // (Optional) You may change this to any other.html
            path: '_build',

            // plugins: [
            // ],

            // platforms: ['android'],

            maxBuffer: 200, // You may need to raise this for iOS.
            verbose: false,
            releases: 'releases',
            releaseName: function () {
                var pkg = grunt.file.readJSON('package.json');
                return ( pkg.name + '-' + pkg.version );
            },
            debuggable: false,

            // Must be set for ios to work:
            name: function () {
                var pkg = grunt.file.readJSON ( 'package.json' );
                return pkg.name;
            },

            // Add a key if you plan to use the `release:android` task:
            // See http://developer.android.com/tools/publishing/app-signing.html
            key: {
                store: 'release.keystore',
                alias: 'release',
                aliasPassword: function () {
                    // Prompt, read an environment variable, or just embed as a string literal
                    return('');
                },
                storePassword: function () {
                    // Prompt, read an environment variable, or just embed as a string literal
                    return('');
                }
            },

            // Set an app icon at various sizes:
            icons: {
                android: {
                    ldpi: 'icon-36-ldpi.png',
                    mdpi: 'icon-48-mdpi.png',
                    hdpi: 'icon-72-hdpi.png',
                    xhdpi: 'icon-96-xhdpi.png'
                },
                wp8: {
                    app: 'icon-62-tile.png',
                    tile: 'icon-173-tile.png'
                },
                ios: {
                    icon29: 'icon29.png',
                    icon29x2: 'icon29x2.png',
                    icon40: 'icon40.png',
                    icon40x2: 'icon40x2.png',
                    icon57: 'icon57.png',
                    icon57x2: 'icon57x2.png',
                    icon60x2: 'icon60x2.png',
                    icon72: 'icon72.png',
                    icon72x2: 'icon72x2.png',
                    icon76: 'icon76.png',
                    icon76x2: 'icon76x2.png'
                }
            },

            // Set a splash screen at various sizes:
            screens: {
                android: {
                    ldpi: 'screen-ldpi-portrait.png',
                    ldpiLand: 'screen-ldpi-landscape.png',
                    mdpi: 'screen-mdpi-portrait.png',
                    mdpiLand: 'screen-mdpi-landscape.png',
                    hdpi: 'screen-hdpi-portrait.png',
                    hdpiLand: 'screen-hdpi-landscape.png',
                    xhdpi: 'screen-xhdpi-portrait.png',
                    xhdpiLand: 'www/screen-xhdpi-landscape.png'
                },
                ios: {
                    ipadLand: 'screen-ipad-landscape.png',
                    ipadLandx2: 'screen-ipad-landscape-2x.png',
                    ipadPortrait: 'screen-ipad-portrait.png',
                    ipadPortraitx2: 'screen-ipad-portrait-2x.png',
                    iphonePortrait: 'screen-iphone-portrait.png',
                    iphonePortraitx2: 'screen-iphone-portrait-2x.png',
                    iphone568hx2: 'screen-iphone-568h-2x.png'
                }
            },

            // Android-only integer version to increase with each release:
            // See http://developer.android.com/tools/publishing/versioning.html
            versionCode: function () { return ( 1 ) },

            // Android-only options that will override the defaults set by Phonegap in the
            // generated AndroidManifest.xml:
            // See https://developer.android.com/guide/topics/manifest/uses-sdk-element.html
            minSdkVersion: function () { return ( 10 ) },
            targetSdkVersion: function () { return ( 19 ) },

            // iOS7-only options that will make the status bar white and transparent
            iosStatusBar: 'WhiteAndTransparent',

            // If you want to use the Phonegap Build service to build one or more
            // of the platforms specified above, include these options:
            // See https://build.phonegap.com/
            // remote: {
            //  username: 'your_username',
            //  password: 'your_password',
            //  platforms: ['android', 'blackberry', 'ios', 'symbian', 'webos', 'wp7']
            // },

            // Set an explicit Android permissions list to override the automatic plugin defaults.
            // In most cases, you should omit this setting. See 'Android Permissions' in README.md for details.
            // permissions: ['INTERNET', 'ACCESS_COURSE_LOCATION', '...']
        }
    },

More info:

"grunt": "^0.4.5",
"grunt-phonegap": "^0.15.2",

Phonegap 3.4

Command: grunt phonegap:build:android

BTW:

I'll be nice to have documentation what all these config settings are doing...

@levexis
Copy link
Collaborator

levexis commented Aug 6, 2014

I have the same error with phonegap 3.5. Have downgraded to phonegap 3.3 and it works.

@felipecm
Copy link

+1 I have the same problem

@felipecm
Copy link

The cordova CLI is creating the platforms directories relative to process.cwd.

workaround: create a symlink at root directory pointing to phonegap.config.path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants