User Tools

Site Tools


android:gradle

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
android:gradle [2013/07/29 22:38] – [What's Groovy] percyandroid:gradle [2013/07/29 22:55] – [Gradle build script example] percy
Line 85: Line 85:
 The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead. The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
 </code> </code>
-===== Gradle user guide =====+=====Android Gradle user guide ===== 
 +Gradle Plugin User Guide:http://tools.android.com/tech-docs/new-build-system/user-guide
  
 +Gradle is an advanced build system as well as an advanced build toolkit allowing to create custom build logic through plugins.
  
-===== Gradle command =====+Here are some of its features that made us choose Gradle
 +  * Domain Specific Language (DSL) to describe and manipulate the build logic 
 +  * Build files are Groovy based and allow mixing of declarative elements through the DSL and using code to manipulate the DSL elements to provide custom logic. 
 +  * Built-in dependency management through Maven and/or Ivy. 
 +  * Very flexible. Allows using best practices but doesn’t force its own way of doing things. 
 +  * Plugins can expose their own DSL and their own API for build files to use. 
 +  * Good Tooling API allowing IDE integration
  
 +
 +===== Gradle command =====
 +Gradle Command Line :http://www.gradle.org/docs/current/userguide/gradle_command_line.html
 ===== What's Groovy ===== ===== What's Groovy =====
 Groovy:http://groovy.codehaus.org/ Groovy:http://groovy.codehaus.org/
 +
 +[[wp>Groovy_(programming_language)]]
 +
  
 <code> <code>
Line 107: Line 121:
 </code> </code>
 ===== Gradle build script example ===== ===== Gradle build script example =====
 +<file Groovy build.grade>
 +buildscript {
 +    repositories {
 +        mavenCentral()
 +    }
 +    dependencies {
 +        classpath 'com.android.tools.build:gradle:0.4'
 +    }
 +}
 +
 +apply plugin: 'android'
 +
 +dependencies {
 +    compile files('libs/android-support-v4.jar',
 +     'libs/webimageloader-1.1.4.jar',
 +     'libs/square-otto-1.3.2.jar',
 +     'libs/libGoogleAnalyticsV2.jar',
 +     'libs/android-support-v4.jar',
 +     'libs/androidannotations-api-2.7.jar',
 +     'libs/disklrucache-1.3.1.jar'
 +     )
 +}
 +
 +android {
 +    compileSdkVersion 17
 +    buildToolsVersion "17"
 +
 +
 +    defaultConfig {
 +        minSdkVersion 8
 +        targetSdkVersion 17
 +    }
 +
 +    sourceSets {
 +        main {
 +            manifest.srcFile 'AndroidManifest.xml'
 +            java.srcDirs = ['src','.apt_generated']
 +            resources.srcDirs = ['src']
 +            aidl.srcDirs = ['src']
 +            renderscript.srcDirs = ['src']
 +            res.srcDirs = ['res']
 +            assets.srcDirs = ['assets']
 +        }
 +
 +        instrumentTest.setRoot('tests')
 +    }
 +
 +    signingConfigs {
 +        debug {
 +            storeFile file("proguard/debug.keystore")
 +        }
 +
 +        releaseConfig{
 +            storeFile file("proguard/XXXXX.keystore")
 +            storePassword "XXXX"
 +            keyAlias "XXXX"
 +            keyPassword "XXXX"
 +        }
 +    }
 +
 +    buildTypes {
 +        release {
 +            runProguard true
 +            proguardFile getDefaultProguardFile('proguard-android.txt')
 +            signingConfig signingConfigs.releaseConfig
 +        }
 +    }
 +}
 +</file>
 +
 +====Basic Usage ====
  
 +  gradle assemble
  
  
  
/var/www/dokuwiki/wiki/data/pages/android/gradle.txt · Last modified: 2016/05/05 13:07 by 127.0.0.1