Android Gradle configuration [Go]

Source: Internet
Author: User

Reprinted from: http://pybeta.com/2016/06/about-gradle/

Android gradle Configuration Compilation acceleration

In the gradle.properties configure

1 org.gradle.configureondemand=true               #demand2org.gradle.daemon=true                          #单独的守护进程 3 org.gradle.parallel=true                        #串行编译 4 org.gradle.jvmargs=-xmx2048m-xx:maxpermsize=512m-xx:+ Heapdumponoutofmemoryerror-dfile.encoding=utf-8                  #内存设置

build.gradleAdded in

1 lintoptions {  2    disable ' invalidpackage ', ' contentdescription '  3     Abortonerror false  4}  5  6dexoptions {  7     Jumbomode = True 8     predexlibraries = False  9    javamaxheapsize "4g"

supports only specific ABI

abiFiltersConfiguration, can be Product flavors used in conjunction with.

1 NDK {2    abifilters "Armeabi", "x86"3 }

Relying on library version management

Unified definition in Project Engineering build.gradle

1 ext {  2    //SDK and Tools  3    minsdkversion =  4     Targetsdkversion =  5    compilesdkversion =  6     buildtoolsversion = ' 23.0.2 '  7  8    //App dependencies  9     supportversion = ' 23.4.0 ' Ten }

Used in module engineering build.gradle

1 Android {2 compilesdkversion rootProject.ext.compileSdkVersion3 buildtoolsversion rootProject.ext.buildToolsVersion4 }5 6 Dependencies {7 //APP ' s dependencies, including Test8 compile "com.android.support:appcompat-v7: $rootProject. Supportversion"9 compile "com.android.support:cardview-v7: $rootProject. Supportversion"Ten compile "com.android.support:design: $rootProject. Supportversion" One compile "com.android.support:recyclerview-v7: $rootProject. Supportversion" A compile "com.android.support:support-v4: $rootProject. Supportversion" -}

Dependent Library multi-version resolution
1 Configurations.all {2    resolutionstrategy.force "com.android.support:support-v4:$ Rootproject.supportversion "3 }

Signature information

Project to addsign.properties

1 Keystore=[path To]\release.keystore 2 keystore.password=********* 3 keyalias=*********** 4 keypassword=********

build.gradlereading the file and setting the signature information

1 if (New File (Project.property ("Sign.properties")). Exists ()) {2 3 Properties Props = new properties ()4 Props.load (New FileInputStream (File (Project.property ("Sign.properties" )))5 6 Signingconfigs {7 Release {8 storefile file (props[' KeyStore ')9 storepassword props[' Keystore.password ']Ten keyalias props[' Keyalias '] One keypassword props[' Keypassword '] A         } -     } -}

Android Gradle configuration [Go]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.