When I migrate to com.android.tools.build:gradle:3.0.0-beta3
and Gradle 4.1, I am seeing the following error:
Caused by: org.gradle.api.artifacts.UnknownConfigurationException: Configuration with name 'compileClasspath' not found. at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.createNotFoundException(DefaultConfigurationContainer.java:123) at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:229) at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getByName(DefaultConfigurationContainer.java:113) at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getByName(DefaultConfigurationContainer.java:48) at com.android.build.gradle.internal.LintGradleProject$ProjectSearch.getProject(LintGradleProject.java:884) at com.android.build.gradle.internal.LintGradleProject$ProjectSearch.getProject(LintGradleProject.java:996) at com.android.build.gradle.internal.LintGradleProject$ProjectSearch.getProject(LintGradleProject.java:785) at com.android.build.gradle.internal.LintGradleClient.createLintRequest(LintGradleClient.java:193) at com.android.tools.lint.LintCliClient.run(LintCliClient.java:151) at com.android.build.gradle.internal.LintGradleClient.run(LintGradleClient.java:209) at com.android.build.gradle.tasks.Lint.runLint(Lint.java:365) at com.android.build.gradle.tasks.Lint.lintSingleVariant(Lint.java:335)
Here is my directory structure:
android-db
/db
/build.gradle
settings.gradle
/android-common
build.gradle
/common
build.gradle
android-db/db/build.gradle
is the following:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta3'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}
}
repositories {
jcenter()
maven { url "https://jitpack.io" }
google()
}
def jenkinsBuildNumber = {
System.getenv().BUILD_NUMBER?.toInteger() ?: 999999
}
// Change this when we upgrade the library version
def buildVersion = {
'1.0' + "." + jenkinsBuildNumber()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.0.1'
implementation project(path: ':android-common:common', configuration: 'default')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
testImplementation "org.robolectric:robolectric:3.0"
implementation 'com.annimon:stream:1.1.5'
implementation 'com.jakewharton.timber:timber:4.5.1'
implementation 'com.google.code.gson:gson:2.4'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
}
android-db/android-common/common/build.gradle
is the following:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta3'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
minSdkVersion 15
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
}
dataBinding {
enabled = true
}
}
repositories {
jcenter()
maven { url "https://jitpack.io" }
google()
}
def jenkinsBuildNumber = {
System.getenv().BUILD_NUMBER?.toInteger() ?: 999999
}
// Change this when we upgrade the library version
def buildVersion = {
'1.0' + "." + jenkinsBuildNumber()
}
ext {
supportLibVersion = '25.3.1'
playServicesVersion = '10.2.6'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.android.support:support-v4:${supportLibVersion}"
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.google.android.gms:play-services-maps:${playServicesVersion}"
compile 'com.android.databinding:library:1.3.1'
compile 'com.android.databinding:adapters:1.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'org.jsoup:jsoup:1.9.2'
compile 'com.jakewharton.timber:timber:4.5.1'
compile 'com.squareup:seismic:1.0.2'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.google.code.gson:gson:2.4'
compile "com.android.support:recyclerview-v7:${supportLibVersion}"
compile 'javax.inject:javax.inject:1@jar'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
// Unit testing dependencies
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
// Set this dependency if you want to use the Hamcrest matcher library
//androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
// more stuff, e.g., Mockito
testCompile "org.robolectric:robolectric:3.3"
}
Today I've solved the same problem! I've spent more than a week trying to find a solution. In short Lint-plugin for Gradle implicitly supposes that you have the following section
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:$gradlePluginVersion"
}
}
in your root-level build.gradle
file. Just move that common section from your scripts right to the root-level script.
Just add the compileClasspath as a configuration name to your build.gradle
configurations {
compileClasspath
}
buildscript {
repositories {
...
}
dependencies {
...
}
}
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