Alternatively, keep the 'compile' dependency on the Android plugin and omit
the 'classpath' dependency inside the instrumented project's build.gradle.
Since the Android plugin then gets added automatically as a transitive
dependency of your plugin's classpath, you simply need the 'apply plugin'
declaration.
On Wednesday, December 23, 2015 at 12:58:11 PM UTC-5, Jake Wharton wrote:
>
> Epic thread revival! I start receiving this again on a new project I'm
> working on and decided to spend the time narrowing down the cause instead
> of just working around.
>
> This happens when linking your Gradle plugin against the Android plugin
> and then trying to test that plugin through the tooling API. Normally you
> would just add a 'compile' dependency on the Android plugin, but this is
> what ends up causing the problem as it puts the Android plugin onto the
> classpath with your plugin instead of letting Gradle look it up normally.
>
> The fix is to mark the Android plugin as 'provided', which of course
> Gradle doesn't provide a configuration for. You can add your own, but you
> need to be careful how to do it. I chose this method:
>
> configurations {
> provided
> }
>
> sourceSets {
> main {
> compileClasspath += configurations.provided
> }
> }
>
> instead of the Nebula plugin
> <https://github.com/nebula-plugins/gradle-extra-configurations-plugin>
> (which still causes the problem). This removes the Android plugin
> dependencies from showing up in sourceSets.main.runtimeClasspath which is
> used to bootstrap the plugin on the other side of the tooling invocation.
>
> On Friday, May 30, 2014 at 4:46:02 PM UTC-4, Tor Norbye wrote:
>>
>> That's weird. It looks like it's somehow using the wrong version of ECJ.
>> I know there have been some bugs in the past where Gradle ended up with
>> some wrong versions of some artifacts (I can't remember the details, only
>> that some people would run into weird class loading problems, and the
>> workaround was to run gradlew with the command to refresh its dependencies;
>> might have been --refresh-dependencies).
>>
>>
>> On Sun, May 25, 2014 at 9:15 PM, Jake Wharton <[email protected]> wrote:
>>
>>> I’m invoking ‘clean build’ on a project through the tooling api and
>>> getting this exception from the lint task.
>>>
>>> Caused by: java.lang.NoSuchFieldError: originalComplianceLevel
>>> at
>>> com.android.tools.lint.EcjParser.createCompilerOptions(EcjParser.java:132)
>>> at com.android.tools.lint.EcjParser.getParser(EcjParser.java:168)
>>> at com.android.tools.lint.EcjParser.<init>(EcjParser.java:115)
>>> at
>>> com.android.tools.lint.LintCliClient.getJavaParser(LintCliClient.java:188)
>>> at
>>> com.android.tools.lint.client.api.LintDriver$LintClientWrapper.getJavaParser(LintDriver.java:2081)
>>> at
>>> com.android.tools.lint.client.api.LintDriver.checkJava(LintDriver.java:1636)
>>> at
>>> com.android.tools.lint.client.api.LintDriver.runFileDetectors(LintDriver.java:1024)
>>> at
>>> com.android.tools.lint.client.api.LintDriver.checkProject(LintDriver.java:880)
>>> at
>>> com.android.tools.lint.client.api.LintDriver.analyze(LintDriver.java:431)
>>> at
>>> com.android.tools.lint.client.api.LintDriver.analyze(LintDriver.java:374)
>>> at com.android.tools.lint.LintCliClient.run(LintCliClient.java:116)
>>> at
>>> com.android.build.gradle.internal.LintGradleClient.run(LintGradleClient.java:102)
>>> at
>>> com.android.build.gradle.internal.LintGradleClient$run.call(Unknown Source)
>>> at com.android.build.gradle.tasks.Lint.runLint(Lint.groovy:187)
>>> at com.android.build.gradle.tasks.Lint.this$4$runLint(Lint.groovy)
>>> at
>>> com.android.build.gradle.tasks.Lint$this$4$runLint.callCurrent(Unknown
>>> Source)
>>> at
>>> com.android.build.gradle.tasks.Lint.lintAllVariants(Lint.groovy:79)
>>> at
>>> com.android.build.gradle.tasks.Lint$lintAllVariants.callCurrent(Unknown
>>> Source)
>>> at com.android.build.gradle.tasks.Lint.lint(Lint.groovy:67)
>>> at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
>>> at
>>> org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
>>> at
>>> org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
>>> at
>>> org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
>>> at
>>> org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
>>> at
>>> org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
>>> at
>>> org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
>>> at
>>> org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
>>> ... 67 more
>>>
>>> The project contains two subprojects which are empty.
>>>
>>> ├── build.gradle
>>> ├── child1
>>> │ ├── build.gradle
>>> │ └── src
>>> │ └── main
>>> │ └── AndroidManifest.xml
>>> ├── child2
>>> │ ├── build.gradle
>>> │ └── src
>>> │ └── main
>>> │ └── AndroidManifest.xml
>>> └── settings.gradle
>>>
>>> The manifests have a package and minSdkVersion. The build files just
>>> declare the compilation SDK, build tools, and compile options of Java 7.
>>>
>>> The tooling API configures its JVM with the following:
>>>
>>> Starting process 'Gradle build daemon'. Working directory:
>>> /Users/jw/.gradle/daemon/1.12 Command:
>>> /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java
>>> -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m
>>> -Dfile.encoding=UTF-8 -cp
>>> /Users/jw/.gradle/wrapper/dists/gradle-1.12-bin/2qvnajdoo11hasdfkikjaci26k/gradle-1.12/lib/gradle-launcher-1.12.jar
>>> org.gradle.launcher.daemon.bootstrap.GradleDaemon 1.12
>>> /Users/jw/.gradle/daemon 10800000 ce16beb0-1e02-4462-8aca-c0383f113185
>>> -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m
>>> -Dfile.encoding=UTF-8
>>>
>>> Invoking a 'clean build' directly on the project runs fine.
>>>
>>> Any idea what’s happening here?
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "adt-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.