【问题标题】:Unable to find method 'org.gradle.api.tasks.compile.CompileOptions找不到方法'org.gradle.api.tasks.compile.CompileOptions
【发布时间】:2020-03-16 04:22:06
【问题描述】:
我没有改变任何东西。
请有人帮我解决这个问题:
错误:找不到方法 'org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(Ljava/lang/String;)V'。
此意外错误的可能原因包括:
Gradle 的依赖缓存可能已损坏(这有时会在网络连接超时后发生。)
重新下载依赖并同步项目(需要网络)
Gradle 构建过程(守护进程)的状态可能已损坏。停止所有 Gradle 守护程序可能会解决此问题。
停止 Gradle 构建过程(需要重新启动)
您的项目可能正在使用与项目中的其他插件或项目请求的 Gradle 版本不兼容的第三方插件。
在 Gradle 进程损坏的情况下,您也可以尝试关闭 IDE,然后杀死所有 Java 进程。
【问题讨论】:
标签:
android
android-studio
gradle
dependencies
【解决方案1】:
应用程序(构建.gradle)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.2'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "https://maven.google.com" }
google()
}
// source :
// https://stackoverflow.com/questions/34828426/disable-javadoc-check-for-bintray-upload
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}