android - 06 - gradle

Download Android - 06 - Gradle

Post on 23-Jun-2015

286 views

Category:

Technology

0 download

Embed Size (px)

DESCRIPTION

Gradle for Android developers

TRANSCRIPT

  • 1. Gradle Android Internship 2014

2. Gradle Windows Linux : JavaDoc Web- 3. Gradle Apache Ant XML- build.xml (target) (task) 4. Gradle Apache Ant 5. Gradle Apache Maven XML- pom.xml Maven- (clean, compile, test, package, install, deploy) 6. Gradle Apache Maven 7. Gradle Ant Maven Gradle 8. Gradle Gradle Groovy Java DSL Apache Ant Maven- , Gradle Daemon, Wrapper 9. Gradle Gradle 10. Gradle build/ src/ main/ java/ resources/ build.gradle 11. Gradle Android app/ gradle/ wrapper/ gradle-wrapper.jar gradle-wrapper.properties .gitignore build.gradle gradlew gradlew.bat local.properties settings.gradle app/ build/ libs/ src/ main/ java/ res/ AndroidManifest.xml .gitignore build.gradle proguard.pro 12. Gradle Android app/ gradle/ Gradle gradle/wrapper/ Gradle Wrapper .gitignore , Git build.gradle build- Gradle gradlew, gradlew.bat Gradle Wrapper local.properties Android SDK settings.gradle 13. Gradle Android app/build/ - app/libs/ app/src/ app/src/main/java Java- app/src/main/res app/src/main/AndroidManifest.xml Android Manifest app/.gitignore , Git app/build.gradle build- Gradle app/proguard.pro ProGuard 14. Gradle Build Script allprojects {} Configures this project and each of its sub-projects. buildscript {} Configures the build script classpath for this project. repositories {} Configures the repositories for this project. dependencies {} Configures the dependencies for this project. 15. Gradle ./build.gradle buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:0.12.+' } } allprojects { repositories { jcenter() } } 16. Gradle ./build.gradle buildscript build- Gradle repositories . dependencies . Gradle- Android-. build-. com. android.tools.build, gradle 0.12.+. allprojects (.. ) repositories , jCentral. 17. Gradle ./settings.gradle include :app 18. Gradle ./app/build.gradle apply plugin: com.android.application android { compileSdkVersion 19 buildToolsVersion 20.0.0 defaultConfig { applicationId com.example.myapplication minSdkVersion 14 targetSdkVersion 19 versionCode 1 versionName 1.0 } } dependencies { compile fileTree(dir: libs, include: [*.jar]) } 19. Gradle ./app/build.gradle apply . , clean, assemble, build, install . com.android. application. android Android. compileSdkVersion SDK buildToolsVersion APK defaultConfig : ID, , minSdkVersion, targetSdkVersion . . dependencies -. 20. Gradle Android Library Build apply plugin: com.android.library android { compileSdkVersion 19 buildToolsVersion 20.0.0 defaultConfig { applicationId com.mylibrary minSdkVersion 14 targetSdkVersion 19 versionCode 1 versionName 1.0 } } dependencies { compile fileTree(dir: libs, include: [*.jar]) } 21. Gradle Dependencies compile fileTree(dir: libs, include: [*.jar]) compile project(:mylibrary) compile com.squareup.picasso:picasso:2.3.2 22. Gradle Build variants Build type Product flavor Build variant 23. Gradle Build variants src/main src/ src/debug src/release src/ src/demo src/full 24. Gradle Build variants android { defaultConfig { } buildTypes { } productFlavors { demo { applicationId com.application.demo versionName 1.0-demo } full { applicationId com.application.full versionName 1.0-full } } } 25. Gradle