-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gradle project sync is failing with Cobertura plugin in Android project #119
Comments
I'm not sure what might be happening here. You are correctly applying the android plugin first, which should prevent the cobertura plugin from applying the java plugin. I just released version 2.4.0 of the plugin, and it includes some additional messaging. When you run the Gradle build with the |
Here is the full output of the Gradle build with the --info flag. This is using version 2.4.0:
Looks like it's applying to a Java project based on the line "Creating cobertura extension for java project app" Output of build with --stacktrace option:
|
The cobertura plugin needs to know if the android plugin has been applied so it can decide if it needs to configure itself for a java build or an android one, which is why it needs to be applied first. What is really fascinating about your output is that it looks like it is applying the cobertura plugin before the android plugin, even though you're clearly trying to apply android first. I haven't seen anything in the docs that would suggest that Gradle would apply plugins in any order other than the one you specify. Out of curiousity, What happens if you add the following between the two "apply" lines of your build.gradle:
|
Still a failure, the hasPlugin returns True though.
|
I just noticed that we are dealing with a multi project build. Is there anyway that the cobertura plugin could be applied before the android plugin? From the last log, it looks like cobertura is being applied to the app project before Gradle knows about the android project. What does app/build.gradle look like? Is there an allprojects or subprojects block in the main build.gradle? |
Here's the top level build.gradle. Looks like there is an allprojects block:
If I add the cobertura plugin there the build is successful:
|
I must confess that this leaves me even more confused than before :-) Adding the cobertura plugin to the root project without adding android should cause the cobertura plugin to add java the root project. I would expect this to make the problem worse, not better... Your allprojects block only defines a repository that should be available, so that shouldn't be effecting plugin application to any of the projects. I feel like the root of the problem is that gradle appears to apply android plugin after cobertura even though you've specified that android should be applied first, but I'm not sure how to get around that problem. |
The reason for that behavior is:
triggers the plugin without the need of And since defining a
I managed to get around this by using the 2nd method here: https://github.com/stevesaliman/gradle-cobertura-plugin/blob/master/usage.md#applying-the-plugin
|
Good eye @KhaledHelmy. I was so busy looking at the two "apply" statements, that I didn't notice that the Cobertura plugin was also in the "plugins" section. |
I am trying to use the Cobertura plugin for creating coverage reports on an Android project. I followed the usage guide but Gradle fails to sync after I apply the cobertura plugin. Here is what my build.gradle looks like:
Gradle fails with the the error message: "Error, the 'java' plugin has been applied, but it is not compatible with the Android plugins."
I am using Gradle 2.14.1
The text was updated successfully, but these errors were encountered: