Image text to teach you how to use gradle to package Android and gradleandroid in eclipse
Other benefits of gradle are not mentioned. When the android Application is released, if you want to count multiple channels, the benefits of gradle batch packaging will be displayed. The following is a text description.
Select Android when exporting data according to eclipse. For example, click Next step.
After clicking finish, the following files are generated in the project; that is, the configuration file of gradle.
Open the gradle-wrapper.properties file; you can see the address distributionUrl; this address is gradle; open the download in the browser, such:
Decompress the downloaded file. Then, set the system environment variable. Set the variable name: GRADLE_HOME to C: \ xiong \ gradle-1.10-all \ gradle-1.10 (that is, the root directory of the Gradle file you downloaded) and then set path; add C: \ xiong \ gradle-1.10-all \ gradle-1.10 \ bin after
Then run gradle-v in cmd to determine whether the setting is successful, as shown in figure
After confirming that the installation is successful, you can run the gradle command to package it. Locate the cmd command to the root directory of the project, and then run the gradle bulid
For example
If batch packaging is required, configure it in build. gradle.
The file content generated by the original eclipse is as follows:
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.8.+' }}apply plugin: 'android'dependencies { compile fileTree(dir: 'libs', include: '*.jar')}android { compileSdkVersion 19 buildToolsVersion "19.0.3" 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') }}
You only need to add it in the above Code, for example
Buildscript {repositories {mavenCentral ()} dependencies {classpath 'com. android. tools. build: gradle: 0.8. + '} apply plugin: 'android' dependencies {compile fileTree (dir: 'libs', include :'*. jar ')} android {compileSdkVersion 19 buildToolsVersion "19.0.3" 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 wocould // conflict with src/being used by the main source set. // Adding new build types or product flavors shoshould be accompanied // by a similar customization. debug. setRoot ('Build-types/debug') release. setRoot ('Build-types/release ') // batch package -- specify the configuration file // The application tag of different channel vendors for their respective AndroidManifest // The application tag of AndroidManifest only uses the value of the configuration channel number // other public configurations are placed in the Public AndroidManifest. one {manifest. srcFile 'tests/androidmanifest1.xml'} two {manifest. srcFile 'tests/androidmanifest2.xml'} instrumentTest. setRoot ('tests ')} // batch packaging -- declare productFlavors {one {// here you can configure different package names} two {}} // signature signingConfigs {myConfig {storeFile file ("11. keystore ") // signature file storePassword" 111111 "keyAlias" 111111 "keyPassword" 111111 "// signature password }}}
For example
As for the rest, I won't be able to find duniang.
Download demo
Reprinted please indicate the source: http://blog.csdn.net/x605940745