I recently added Kotlin to my Java project, my build started failing, and I am getting this message:
"only buildscript {} and other plugins {} script blocks are allowed before plugins {} blocks, no other statements are allowed" and this "Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:"
Does anyone have any idea how to fix this? I have my jdk set as 1.8 (as you see below), so the existing answer to this question does not seem to apply.
compileOptions { sourceCompatibility '1.8' targetCompatibility '1.8' }
As for the brackets, here's my project build.gradle file where it's referencing.
buildscript {
repositories {
jcenter()
google()
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.5'
}
}
allprojects {
repositories {
jcenter()
google()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.70'
}
I guess I'm at the bleary eyed stage of the day. I moved it before allprojects and it worked. This was helpful: only build script and other plugins script blocks are allowed before plugins
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.