You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Ian Darling (JIRA)" <ji...@apache.org> on 2013/10/23 13:35:44 UTC

[jira] [Commented] (CB-3445) Move Cordova-Android Build Setup to Gradle

    [ https://issues.apache.org/jira/browse/CB-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13802813#comment-13802813 ] 

Ian Darling commented on CB-3445:
---------------------------------

I'm actually using Android Studio/gradle for a phonegap/cordova 3.1 project, and it's working pretty well so far.

Set up a build.gradle in the "android" project, it'll look something like this (includes a single product flavor as an example too):

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.6+'
    }
}

apply plugin: 'android'

android {
    buildToolsVersion '18.1.1'

    compileSdkVersion 17

    defaultConfig {
        versionName "00.00.01"
        versionCode 1
    }

    productFlavors {
        generic {
            packageName 'com.example.application.generic'
        }
    }

    android.sourceSets {
        android.sourceSets.generic {
            java.srcDirs = ['flavors/generic/src']
            assets.srcDirs = ['flavors/generic/assets']
            res.srcDirs = ['flavors/generic/res']
        }

        main {
            manifest.srcFile 'AndroidManifest.xml'
            java {
                srcDir 'src'
            }
            assets {
                srcDir 'assets'
            }
            res {
                srcDir 'res'
            }
        }
    }

    signingConfigs {
        example {
            storeFile file('path/to/keystore')
            storePassword 'example'
            keyAlias 'example'
            keyPassword 'example'
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.example
        }
    }
}

dependencies {
    compile files('libs/cordova-3.1.0.jar')
}

> Move Cordova-Android Build Setup to Gradle
> ------------------------------------------
>
>                 Key: CB-3445
>                 URL: https://issues.apache.org/jira/browse/CB-3445
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Android
>            Reporter: Joe Bowser
>            Assignee: Joe Bowser
>             Fix For: 3.2.0
>
>
> Currently we're using ant for our setup, and our setup can break every time that the Android SDK updates and change its build.xml.  However, the Android Team has created Gradle to be more robust such that it doesn't have the same problems as ant-based scripts.
> This also has the advantage of using Android Studio for development instead of Eclipse, and the ability for us to bundle resources, which is something we haven't been able to do before.
> Moving to Gradle has numerous advantages, but will break scripts, so this is to be moved in the post-3.0 timeframe.



--
This message was sent by Atlassian JIRA
(v6.1#6144)