0

android studio use gradle to compiler android apk
gradle is a build system
so google write the plugin 'com.android.application'?
if this is ture why should a dependencies {classpath 'com.android.tools.build:gradle:2.1.3'}
and what it use for?

the 2.1.3 seems to mean the version of android studio

what is the different between
the com.android.tools.build:gradle:2.1.3 in

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.1.3'
}

}

and the com.android.application in

apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion "24.0.1"
}

dependencies {
}
Cong Wu
  • 372
  • 2
  • 16
  • no is different – Cong Wu Sep 09 '16 at 05:54
  • How so? You need the `dependency` in the `classpath` in order to `apply` the `plugin`. – OneCricketeer Sep 09 '16 at 05:56
  • And I could be wrong, but the Gradle plugin version number isn't necessarily the same as the Android Studio version. For example, you are welcome to download the beta 2.2 versions of the Gradle plugin and use them on Android Studio 2.1.3 – OneCricketeer Sep 09 '16 at 06:00
  • i see now i understand.so it switch the 'com.android.application' by classpath 'com.android.tools.build:gradle:2.1.3' thanks – Cong Wu Sep 09 '16 at 06:00
  • No switch. The `classpath` allows you the ability to add the `plugin`. – OneCricketeer Sep 09 '16 at 06:13
  • You can't use the plugin without declaring it in the buildscript block. Take a look at documentatio: http://stackoverflow.com/documentation/android-gradle/2161/configure-your-build-with-gradle/7075/why-are-there-two-build-gradle-files-in-an-android-studio-project#t=201609090629426861609 – Gabriele Mariotti Sep 09 '16 at 06:29
  • gradle will find the plugin in classpath? – Cong Wu Sep 10 '16 at 13:24

0 Answers0