Solution 1 :
Hmm, I think I have it figured out, after reading a bit of Custom Gradle Plugin ID not found .
The thing is – I could build SpannedGridLayoutManager
with ./gradlew assemble
; but the error message I get, appears specifically when I build it as a dependent project.
The thing is: when I build SpannedGridLayoutManager
standalone, first SpannedGridLayoutManager/build.gradle
gets called, and defines classpath
s in dependencies
in buildscript
– then when SpannedGridLayoutManager/spannedgridlayoutmanager/build.gradle
, the plugin ids get resolved according to the classpath
s defined earlier.
When I build my project, of course first MyProject/build.gradle
runs – but it did not have the same classpath
s set; so then when MyProject/../SpannedGridLayoutManager/spannedgridlayoutmanager/build.gradle
gets processed – as a dependent project – the classpaths are not defined, and the plugin lookup fails.
So in my project, I basically had to add these two lines in build.gradle
– here shown as a diff:
$ git diff build.gradle
diff --git a/build.gradle b/build.gradle
index b730fda..6a696c9 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,5 +1,6 @@
buildscript {
ext.kotlin_version = "1.4.0"
+ ext.dokka_version = '0.9.18'
repositories {
google()
jcenter()
@@ -10,6 +11,7 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.android.tools.build:gradle:4.0.1"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
+ classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:$dokka_version"
}
}
Of course, these two lines are copied verbatim from the original build file, SpannedGridLayoutManager/build.gradle
.
Well, nice to get this fixed – but it would have been even better, with a better error message (or even, if ./gradlew --debug
would say something like searching classpaths for ...
and dump out everything where it looked, and what it found).
Problem :
I am trying to build a project that uses: https://github.com/Arasthel/SpannedGridLayoutManager
When I run ./gradlew --assemble
, I get:
1: Task failed with an exception.
-----------
* Where:
Build file '/path/to/SpannedGridLayoutManager/spannedgridlayoutmanager/build.gradle' line: 3
* What went wrong:
A problem occurred evaluating project ':spannedlm'.
> Plugin with id 'org.jetbrains.dokka-android' not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.
This is SpannedGridLayoutManager/spannedgridlayoutmanager/build.gradle
:
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.dokka-android'
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaAndroidTask) {
delete "$rootDir/docs"
outputFormat = 'html'
outputDirectory = "$rootDir/docs"
externalDocumentationLink {
url = new URL("https://developer.android.com/reference/")
}
includeNonPublic = false
// Always recreate documentation
outputs.upToDateWhen { return false }
}
afterEvaluate {
if (project.hasProperty("javadocJar")) {
tasks.javadocJar.dependsOn dokkaJavadoc
}
}
ext {
bintrayRepo = 'maven'
bintrayName = 'spannedgridlayoutmanager'
publishedGroupId = 'com.arasthel'
libraryName = 'SpannedGridLayoutManager'
artifact = 'spannedgridlayoutmanager'
libraryDescription = 'A layout manager that will resize and reorder views based on a provided SpanSize.'
siteUrl = 'https://github.com/Arasthel/SpannedGridLayoutManager'
gitUrl = 'https://github.com/Arasthel/SpannedGridLayoutManager.git'
libraryVersion = '3.0.2'
developerId = 'Arasthel'
developerName = 'Jorge Martín Epsinosa'
developerEmail = '[email protected]'
licenseName = 'MIT'
licenseUrl = 'https://opensource.org/licenses/MIT'
allLicenses = ["MIT"]
}
android {
//compileSdkVersion 28
compileSdkVersion 29
buildToolsVersion buildtools_version
defaultConfig {
minSdkVersion 14
//targetSdkVersion 28
targetSdkVersion 28
versionCode 1
versionName libraryVersion
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
tasks.withType(Javadoc) {
excludes = ['**/*.kt']
}
dependencies {
implementation "com.android.support:recyclerview-v7:$support_library_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
// Bintray Upload
apply from: '../gradle/tools/bintrayv1.gradle'
apply from: '../gradle/tools/installv1.gradle'
This is SpannedGridLayoutManager/build.gradle
:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
//ext.kotlin_version = '1.3.10'
ext.kotlin_version = '1.3.61'
ext.support_library_version = '28.0.0'
//ext.dokka_version = '0.9.17'
ext.dokka_version = '0.9.18'
ext.buildtools_version = '28.0.3'
repositories {
jcenter()
google()
}
dependencies {
//classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:$dokka_version"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
What do I need to do to get this to work?
Aside – this looks like some plugin, that gradlew
cannot retrieve online from its repository.
Is there a command to see all available plugins visible to gradlew
for a given configuration? Something like apt-show-versions -R -a
would list all packages available to apt
in Debian?