[英]Caused by groovy.lang.MissingPropertyException Could not get unknown property 'android' for project ':lib1' of type org.gradle.api.Project
To solve my problem here : Applying JaCoCo to all Android Studio gradle modules, I applied the solution here .要在这里解决我的问题:Applying JaCoCo to all Android Studio gradle modules,我在这里应用了解决方案。 This works fine so far for modules with
到目前为止,这对于具有
plugins {
id("com.android.library")
}
As soon as I add the required apply from: '../jacoco/modules.gradle'
into a module labeled as a Java library一旦我将所需的
apply from: '../jacoco/modules.gradle'
添加到标记为 Java 库的模块中
plugins {
id("java-library")
}
I get a我得到一个
Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'android' for project ':lib1' of type org.gradle.api.Project.
I would like to add the apply from
to the java library, so that JaCoCo reports were generated for them as well.我想将
apply from
添加到 java 库,以便为它们生成 JaCoCo 报告。 What am I missin here?我在这里想念什么?
I assume you have also applied the snippet from the “Improvements” section of the solution you have linked to your ../jacoco/modules.gradle
file?我假设您还应用了链接到您的
../jacoco/modules.gradle
文件的解决方案“改进”部分中的片段? In that case you could replace that snippet with the following:在这种情况下,您可以用以下内容替换该片段:
project.afterEvaluate {
if (project.pluginManager.hasPlugin('com.android.library')) {
android.libraryVariants.all { variant ->
tasks.create(…)
}
} else {
tasks.create(…)
}
}
If that doesn't solve it, then I'd recommend to run the build with Gradle's --stacktrace
option.如果那不能解决问题,那么我建议使用 Gradle 的
--stacktrace
选项运行构建。 That should give you more details on where exactly the missing property was found.这应该会为您提供有关找到丢失属性的确切位置的更多详细信息。
Without more information on your exact build setup it's hard to really say more.如果没有关于您的确切构建设置的更多信息,就很难说更多。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.