MAC下配置gradle用eclipse 打包android程序

1.下載gradle bin
http://gradle.org/gradle-download/java

2.配置gradle,
http://www.douban.com/note/311599602/
http://redfinsolutions.com/blog/creating-bashprofile-your-macandroid

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再配一個環境變量bash

3.eclipse 運用MultiDex和gradle打包android程序
http://wenku.baidu.com/link?url=Dezg0fbS55C2-eQzVMIfLsynb-jMxf1GbTivcnsrI5HpYd_yU-BOlUFxbYU4EJ59Z_OzEwFkZuSsnZNA5rD7A0ye5nxWsnNLf-0ButDC2R7app

android:name="android.support.multidex.MultiDexApplication"eclipse

4.keystore 賬號密碼
chenhongwei 111111maven

5.gradle 打包異常ide

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.+' // 改成1.1.+版本
}
}gradle


apply plugin: 'android'ui

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}url

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 2013distributionBase=GRADLE_HOMEdistributionPath=wrapper/distszipStoreBase=GRADLE_HOMEzipStorePath=wrapper/distsdistributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip

相關文章
相關標籤/搜索