Reputation: 2403
I am using Dokka plugin to generate documentation for my kotlin project
Here is the plugin url https://github.com/Kotlin/dokka
I have followed the instructions this is how my Project.gradle looks like
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.15"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is how my app/build.gradle looks like
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'org.jetbrains.dokka'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.kk.testkotlindoc"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dokka {
outputFormat = 'html'
outputDirectory = "$buildDir/javadoc"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
When I execute the below command to generate documentation
./gradlew dokka
It initially downloaded the necessary jar files after the process is completed it is giving me the below error
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/KK/AndroidStudioProjects/TestkotlinDoc/app/build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> java.lang.UnsupportedClassVersionError-com/android/build/gradle/AppPlugin
Unsupported major.minor version 52.0
But I am unable to identify what is the ISSUE or What am I MISSING HERE
Please help me ..
Upvotes: 1
Views: 1954
Reputation: 2012
You can generate Dokka documentatiton without Dokka plugin... Use GradleMavenPush, it has task androidDokka(type: Exec, dependsOn: dokkaInitializer)
and task coreDokka(type: Exec, dependsOn: dokkaInitializer)
apply from: 'https://raw.github.com/Vorlonsoft/GradleMavenPush/master/maven-push.gradle'
Upvotes: 1
Reputation: 97268
The issue is that you're running Dokka under an older JDK version. Dokka requires JDK 8. Please make sure that the environment variable JDK_HOME on your machine points to a JDK 8 installation.
Upvotes: 1