What is default dependency scope in Gradle on Android? -


in gradle in android studio noticed providing dependency scope optional. example:

dependencies {     compile filetree(dir: 'libs', include: ['*.jar'])     testcompile 'junit:junit:4.12'     compile 'com.android.support:appcompat-v7:23.1.1'     compile 'com.android.support:design:23.1.1'             'org.hamcrest:hamcrest-core:1.3'             'org.hamcrest:hamcrest-library:1.3' } 

notice last 2 libraries don't have compile scope attached. left blank , still able sync gradle. default scope if nothing specified here ?

the scope label given dependency configuration. depends on gradle plugins using (i.e.: java plugin or android plugin). if don't add configuration label, saved unlabeled dependency. of time if need compile dependency , not add label, build break. if doesn't break because:

  • you not needing dependency
  • you using gradle plugin handles nicely unlabeled dependencies
  • or (more probably), dependency on build cache or partial build , therefore compiler still able find classes, break if clean project.

related documentation on dependency configuration gradle


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -