To solve my problem here : Applying JaCoCo to all Android Studio gradle modules, I applied the solution here . 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
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. 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? 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. 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.
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.