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
Last revisionBoth sides next revision
android:gradle [2013/07/29 22:42] – [Gradle command] percyandroid:gradle [2013/07/29 23:11] – [Android Gradle] percy
Line 1: Line 1:
 ====== Android Gradle ====== ====== Android Gradle ======
 +Briefly,Android Gradle is a new build system,and we can assume it is used to replace the ant build system.From the Google official post,it can be integrated with the IDE easily,such as Android Studio.
 +And the Gradle script is written with Groovy([[wp>Groovy_(programming_language)]]).
 +
 +Also it will provide a flexible way for customization, for different product but the same source codebase, for different build(debug,release,buildType,Product flavor),and of course it support  obfuscates the source code with proguard.
 +
 +Anyway,I hope it will be continuely improved,developed,and driven by Google. 
  
 ===== What's Gradle ===== ===== What's Gradle =====
Line 103: Line 109:
 ===== What's Groovy ===== ===== What's Groovy =====
 Groovy:http://groovy.codehaus.org/ Groovy:http://groovy.codehaus.org/
 +
 +[[wp>Groovy_(programming_language)]]
 +
  
 <code> <code>
Line 118: Line 127:
 </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