1.下载gradle bin
http://gradle.org/gradle-download/
2.配置gradle,
http://www.douban.com/note/311599602/
http://redfinsolutions.com/blog/creating-bashprofile-your-mac
GRADLE_HOME=/Users/changfeng/bin/gradle-2.7;
export GRADLE_HOME
export PATH=$PATH:$GRADLE_HOME/bin
注意,elcipse 配置生成的是引用GRADLE_USER_HOME,可以将GRADLE_HOME改为GRADLE_USER_HOME再配一个环境变量
3.eclipse 运用MultiDex和gradle打包android程序
http://wenku.baidu.com/link?url=Dezg0fbS55C2-eQzVMIfLsynb-jMxf1GbTivcnsrI5HpYd_yU-BOlUFxbYU4EJ59Z_OzEwFkZuSsnZNA5rD7A0ye5nxWsnNLf-0ButDC2R7
android:name="android.support.multidex.MultiDexApplication"
4.keystore 帐号密码
chenhongwei 111111
5.gradle 打包异常
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.+' // 改为1.1.+版本
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "21.1.2"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
signingConfigs { //签名,这里的文件名和密码是错的,后面还会有从外部导入的语句
myConfig {
//绝对路径和相对路径都可以
storeFile file("/Users/changfeng/Documents/keystore/qqgamezhu") //签名文件
storePassword "111111" //密码
keyAlias "chenhongwei"
keyPassword "111111"
}
}
buildTypes{
release {
//1.添加签名
signingConfig signingConfigs.myConfig
//2.runProguard 执行混淆代码
//runProguard false
//混淆规则文件
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip