If I add my lib to the project, and run command :
> gradlew -q app:dependencies --configuration debugCompileClasspath > app_dependencies_compile.txt
why does com.github.kolyall:utils:1.0.4
lib get the com.android.support:appcompat-v7
lib (and others) with runtime
scope in CompileClasspath
? If their scope is supposed to be runtime
, why are they added to CompileClasspath
?
Output is:
\--- com.github.kolyall:utils:1.0.4
+--- net.danlew:android.joda:2.8.2
| \--- joda-time:joda-time:2.8.2
+--- com.android.support:appcompat-v7:28.0.0-alpha3 -> 28.0.0 (*)
+--- com.android.support:design:28.0.0-alpha3
| +--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| +--- com.android.support:support-compat:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:support-core-ui:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:support-core-utils:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:support-fragment:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:transition:28.0.0-alpha3
| | +--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| | \--- com.android.support:support-compat:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:appcompat-v7:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:cardview-v7:28.0.0-alpha3
| | \--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| \--- com.android.support:recyclerview-v7:28.0.0-alpha3
| +--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| +--- com.android.support:support-compat:28.0.0-alpha3 -> 28.0.0 (*)
| \--- com.android.support:support-core-ui:28.0.0-alpha3 -> 28.0.0 (*)
+--- io.reactivex:rxjava:1.3.0
+--- io.reactivex:rxandroid:1.2.1
\--- javax.annotation:jsr250-api:1.0
Full output is:
Executing tasks: [dependencies, --configuration, debugCompileClasspath]
:app:dependencies
------------------------------------------------------------
Project :app
------------------------------------------------------------
debugCompileClasspath - Resolved configuration for compilation for variant: debug
+--- com.android.support:appcompat-v7:28.0.0
| +--- com.android.support:support-annotations:28.0.0
| +--- com.android.support:support-compat:28.0.0
| | +--- com.android.support:support-annotations:28.0.0
| | +--- com.android.support:collections:28.0.0
| | | \--- com.android.support:support-annotations:28.0.0
| | +--- android.arch.lifecycle:runtime:1.1.1
| | | +--- android.arch.lifecycle:common:1.1.1
| | | | \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
| | | +--- android.arch.core:common:1.1.1
| | | | \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
| | | \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
| | \--- com.android.support:versionedparcelable:28.0.0
| | +--- com.android.support:support-annotations:28.0.0
| | \--- com.android.support:collections:28.0.0 (*)
| +--- com.android.support:collections:28.0.0 (*)
| +--- com.android.support:cursoradapter:28.0.0
| | \--- com.android.support:support-annotations:28.0.0
| +--- com.android.support:support-core-utils:28.0.0
| | +--- com.android.support:support-annotations:28.0.0
| | +--- com.android.support:support-compat:28.0.0 (*)
| | +--- com.android.support:documentfile:28.0.0
| | | \--- com.android.support:support-annotations:28.0.0
| | +--- com.android.support:loader:28.0.0
| | | +--- com.android.support:support-annotations:28.0.0
| | | +--- com.android.support:support-compat:28.0.0 (*)
| | | +--- android.arch.lifecycle:livedata:1.1.1
| | | | +--- android.arch.core:runtime:1.1.1
| | | | | +--- com.android.support:support-annotations:26.1.0 -> 28.0.0
| | | | | \--- android.arch.core:common:1.1.1 (*)
| | | | +--- android.arch.lifecycle:livedata-core:1.1.1
| | | | | +--- android.arch.lifecycle:common:1.1.1 (*)
| | | | | +--- android.arch.core:common:1.1.1 (*)
| | | | | \--- android.arch.core:runtime:1.1.1 (*)
| | | | \--- android.arch.core:common:1.1.1 (*)
| | | \--- android.arch.lifecycle:viewmodel:1.1.1
| | | \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
| | +--- com.android.support:localbroadcastmanager:28.0.0
| | | \--- com.android.support:support-annotations:28.0.0
| | \--- com.android.support:print:28.0.0
| | \--- com.android.support:support-annotations:28.0.0
| +--- com.android.support:support-fragment:28.0.0
| | +--- com.android.support:support-compat:28.0.0 (*)
| | +--- com.android.support:support-core-ui:28.0.0
| | | +--- com.android.support:support-annotations:28.0.0
| | | +--- com.android.support:support-compat:28.0.0 (*)
| | | +--- com.android.support:support-core-utils:28.0.0 (*)
| | | +--- com.android.support:customview:28.0.0
| | | | +--- com.android.support:support-annotations:28.0.0
| | | | \--- com.android.support:support-compat:28.0.0 (*)
| | | +--- com.android.support:viewpager:28.0.0
| | | | +--- com.android.support:support-annotations:28.0.0
| | | | +--- com.android.support:support-compat:28.0.0 (*)
| | | | \--- com.android.support:customview:28.0.0 (*)
| | | +--- com.android.support:coordinatorlayout:28.0.0
| | | | +--- com.android.support:support-annotations:28.0.0
| | | | +--- com.android.support:support-compat:28.0.0 (*)
| | | | \--- com.android.support:customview:28.0.0 (*)
| | | +--- com.android.support:drawerlayout:28.0.0
| | | | +--- com.android.support:support-annotations:28.0.0
| | | | +--- com.android.support:support-compat:28.0.0 (*)
| | | | \--- com.android.support:customview:28.0.0 (*)
| | | +--- com.android.support:slidingpanelayout:28.0.0
| | | | +--- com.android.support:support-annotations:28.0.0
| | | | +--- com.android.support:support-compat:28.0.0 (*)
| | | | \--- com.android.support:customview:28.0.0 (*)
| | | +--- com.android.support:interpolator:28.0.0
| | | | \--- com.android.support:support-annotations:28.0.0
| | | +--- com.android.support:swiperefreshlayout:28.0.0
| | | | +--- com.android.support:support-annotations:28.0.0
| | | | +--- com.android.support:support-compat:28.0.0 (*)
| | | | \--- com.android.support:interpolator:28.0.0 (*)
| | | +--- com.android.support:asynclayoutinflater:28.0.0
| | | | +--- com.android.support:support-annotations:28.0.0
| | | | \--- com.android.support:support-compat:28.0.0 (*)
| | | \--- com.android.support:cursoradapter:28.0.0 (*)
| | +--- com.android.support:support-core-utils:28.0.0 (*)
| | +--- com.android.support:support-annotations:28.0.0
| | +--- com.android.support:loader:28.0.0 (*)
| | \--- android.arch.lifecycle:viewmodel:1.1.1 (*)
| +--- com.android.support:support-vector-drawable:28.0.0
| | +--- com.android.support:support-annotations:28.0.0
| | \--- com.android.support:support-compat:28.0.0 (*)
| \--- com.android.support:animated-vector-drawable:28.0.0
| +--- com.android.support:support-vector-drawable:28.0.0 (*)
| \--- com.android.support:support-core-ui:28.0.0 (*)
+--- com.android.support.constraint:constraint-layout:1.1.3
| \--- com.android.support.constraint:constraint-layout-solver:1.1.3
\--- com.github.kolyall:utils:1.0.4
+--- net.danlew:android.joda:2.8.2
| \--- joda-time:joda-time:2.8.2
+--- com.android.support:appcompat-v7:28.0.0-alpha3 -> 28.0.0 (*)
+--- com.android.support:design:28.0.0-alpha3
| +--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| +--- com.android.support:support-compat:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:support-core-ui:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:support-core-utils:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:support-fragment:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:transition:28.0.0-alpha3
| | +--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| | \--- com.android.support:support-compat:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:appcompat-v7:28.0.0-alpha3 -> 28.0.0 (*)
| +--- com.android.support:cardview-v7:28.0.0-alpha3
| | \--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| \--- com.android.support:recyclerview-v7:28.0.0-alpha3
| +--- com.android.support:support-annotations:28.0.0-alpha3 -> 28.0.0
| +--- com.android.support:support-compat:28.0.0-alpha3 -> 28.0.0 (*)
| \--- com.android.support:support-core-ui:28.0.0-alpha3 -> 28.0.0 (*)
+--- io.reactivex:rxjava:1.3.0
+--- io.reactivex:rxandroid:1.2.1
\--- javax.annotation:jsr250-api:1.0
(*) - dependencies omitted (listed previously)
BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
app.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.github.kolyall:utils:1.0.4'
}
Here is *.pom file from my lib:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.kolyall</groupId>
<artifactId>utils</artifactId>
<version>1.0.4</version>
<packaging>aar</packaging>
<name>utils</name>
<description>A wrapper for utils on Android</description>
<url>https://github.com/Kolyall/BaseUtils</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<id>nickunuchek</id>
<name>Nick Unuchek</name>
<email>[email protected]</email>
</developer>
</developers>
<scm>
<connection>https://github.com/Kolyall/BaseUtils.git</connection>
<developerConnection>https://github.com/Kolyall/BaseUtils.git</developerConnection>
<url>https://github.com/Kolyall/BaseUtils</url>
</scm>
<dependencies>
<dependency>
<groupId>net.danlew</groupId>
<artifactId>android.joda</artifactId>
<version>2.8.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>28.0.0-alpha3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>design</artifactId>
<version>28.0.0-alpha3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxjava</artifactId>
<version>1.3.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxandroid</artifactId>
<version>1.2.1</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<artifactId>rxjava</artifactId>
<groupId>io.reactivex</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
Before Gradle 5.0
gradle didn't support IMPROVED_POM_SUPPORT
, so it was treating all transitive dependencies as compile
by default. (non-jar packaging was unsupported.)
Related Gradle Bug
This was fixed in Gradle 5.0
, where IMPROVED_POM_SUPPORT
was made a default behavior.
Although it's not compulsory, it's a good practice to tell gradle that provided dependency is android archive use
implementation 'com.github.kolyall:utils:1.0.4@aar'{
transitive=true
}
while declaring dependency in gradle. Notice @aar after the version of library
now after upgrading gradle to version 5.0 or higher,
compileClasspath output is
+--- com.google.code.gson:gson:2.8.5
+--- org.apache.commons:commons-lang3:3.8.1
+--- io.reactivex:rxjava:1.1.0
\--- com.github.kolyall:utils:1.0.4
\--- net.danlew:android.joda:2.8.2
\--- joda-time:joda-time:2.8.2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With