2

Tried to implement Dokka in code but keep running into Gradle sync failed: Could not find method classpath() for arguments [org.jetbrains.dokka:dokka-gradle-plugin:0.9.16-eap-2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

I've tried to look at other people's solution but it doesn't seem to work.

https://github.com/Kotlin/dokka/issues/258

This issue from github lead me to stack

Dokka - skip generating javadoc for default android packages

Which also does not work

I've tried to change

ext.dokka_version = '0.9.17'
ext.dokka_version = '0.9.16-eap-2'

Also adding

repositories {
   maven { url "https://dl.bintray.com/kotlin/kotlin-eap/" }
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'org.jetbrains.dokka-android'
...
dokka{
outputFormat = 'javadoc'
outputDirectory = "$buildDir/javadoc"
skipEmptyPackages = true
noStdlibLink = true
}
 ...
dependencies{
classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}"
}
buildscript{
ext.kotlin_version = '1.3.21'
ext.dokka_version = '0.9.16-eap-2'
repositories{
google()
jcenter()
maven { url "https://dl.bintray.com/kotlin/kotlin-eap/" }
}
dependencies{enter code here
classpath 'com.android.tools.build:gradle:3.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:$dokka_version"        
}

I've tried changing and adding different ext.dokka_version but nothing seems to work. I just expect it to run to generate some KDOC.

KKNg
  • 87
  • 1
  • 5

1 Answers1

0

Adding it to the buildscript dependencies instead of outside dependencies for classpath lead it goes to the right classpath

    buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}"
    }
}
repositories {
    jcenter() // or maven { url 'https://dl.bintray.com/kotlin/dokka' }
}

apply plugin: 'org.jetbrains.dokka'
KKNg
  • 87
  • 1
  • 5