Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Not working with Gradle 4.0 #155

Open
FisherKK opened this issue Jun 8, 2017 · 11 comments
Open

Not working with Gradle 4.0 #155

FisherKK opened this issue Jun 8, 2017 · 11 comments

Comments

@FisherKK
Copy link

FisherKK commented Jun 8, 2017

I've been using spoon for 2 years. After updating to Gradle 4.0 when I start my tests with

./gradlew spoon

build quits after few seconds and nothing happens.

Kamils-MacBook-Pro:MyApp F1sherKK$ ./gradlew spoon
Configuration 'debugCompile' in project ':app' is deprecated. Use 'debugImplementation' instead.
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
Configuration 'androidTestCompile' in project ':app' is deprecated. Use 'androidTestImplementation' instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at spoon_9foto28dorsod7a89hm8rr53p.run(/Users/F1sherKK/Dev/MyApp/app/spoon.gradle:117)
The ConfigurableReport.setDestination(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use the method ConfigurableReport.setDestination(File) instead.
at quality_730ycu739lfr6y32p33f471dy$_run_closure2$_closure4$_closure5.doCall(/Users/F1sherKK/Dev/MyApp/config/quality.gradle:52)
Configuration 'testCompile' in project ':app' is deprecated. Use 'testImplementation' instead.
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
:app:spoon UP-TO-DATE

BUILD SUCCESSFUL in 14s

Spoon versions that I use:

  • com.stanfy.spoon:spoon-gradle-plugin:1.2.2

  • com.squareup.spoon:spoon-client:1.6.4

@bmonjoie
Copy link

We have the same problem.
I have cloned the source locally and changed the line at
https://github.com/stanfy/spoon-gradle-plugin/blob/master/src/main/groovy/com/stanfy/spoon/gradle/SpoonPlugin.groovy#L97

from return testVariant.testedVariant.outputs.collect { def projectOutput ->
to return testVariant.outputs.collect { def projectOutput ->
(notice the removal of testedVariant)

installed it locally and it seems to work.
Yet, since I have no clue why testedVariant was there in the first place, I didn't do a PR as I don't know if this breaks legacy or introduce side effects.

Can anybody confirm that would be a correct fix for the problem we are facing ?

gbero added a commit to Frntbac/spoon-gradle-plugin that referenced this issue Aug 29, 2017
@bmonjoie
Copy link

For everyone else facing this issue, we did a quick workaround in our branch at https://github.com/Frntbac/spoon-gradle-plugin/tree/hotfix/fix_for_gradle_4.0

You can use it through jitpack by changing your build.gradle file as follow :

buildscript {
  repositories {
    maven { url 'https://jitpack.io' }
  }

  dependencies {
    classpath 'com.github.Frntbac:spoon-gradle-plugin:hotfix~fix_for_gradle_4.0-SNAPSHOT'
  }
}

Please note it's far from perfect and for example we had to use ./gradlew installDebug spoonDebugAndroidTest (note the installDebug) otherwise the task would not install the apk on the device.

We do not intend on maintaining this branch or repository, it's just a workaround and we thought people might appreciate it but don't expect bug fixing.

@Tapchicoma
Copy link

Having following exception when running @bmonjoie version:

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':android-standalone:spoonQaDebugAndroidTest'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 124
        at com.squareup.spoon.axmlparser.StringBlock.getShort(StringBlock.java:241)
        at com.squareup.spoon.axmlparser.StringBlock.getRaw(StringBlock.java:99)
        at com.squareup.spoon.axmlparser.StringBlock.read(StringBlock.java:66)
        at com.squareup.spoon.axmlparser.AXMLParser.doStart(AXMLParser.java:200)
        at com.squareup.spoon.axmlparser.AXMLParser.<init>(AXMLParser.java:48)
        at com.squareup.spoon.SpoonInstrumentationInfo.parseFromFile(SpoonInstrumentationInfo.java:57)
        at com.squareup.spoon.SpoonRunner.run(SpoonRunner.java:117)
        at com.squareup.spoon.SpoonRunner$run.call(Unknown Source)
        at com.stanfy.spoon.gradle.SpoonRunTask.runSpoon(SpoonRunTask.groovy:191)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:731)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:705)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
        ... 27 more

Android gradle plugin is 3.0.0-beta5. Seems just this change is not enough.

@CAH-peterhewitt
Copy link

@Tapchicoma that look like this bug in spoon that has PR. I'm seeing the same thing.
square/spoon#477

@dweebo
Copy link

dweebo commented Oct 12, 2017

The fix by @bmonjoie works ok until the spoon-gradle-plugin is upgraded to use build tools 3.0.0-beta7. I'm working on patches to get it upgraded and to use spoon-2.0.0-snapshot.

@vasdeepika
Copy link

After upgrading to spoon2.0.0-snapshot, I am getting below exception when I start my tests with
./gradlew spoon

Execution failed for task ':App:spoonDebugAndroidTest'.

Caused by: groovy.lang.MissingMethodException: No signature of method: com.squareup.spoon.SpoonRunner$Builder.setApplicationApk() is applicable for argument types: (java.io.File) values: [/pathToAPK/App-debug.apk]
at com.stanfy.spoon.gradle.SpoonRunTask.runSpoon(SpoonRunTask.groovy:131)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:731)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:705)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)

@vasdeepika
Copy link

Never mind I figured this out, I didn't upgrade spoon-gradle-plugin before.

@Davidvete
Copy link

So we should use
classpath 'com.stanfy.spoon:spoon-gradle-plugin:spoon-2.0.0-snapshot'?

@alexilyenko
Copy link

Can someone explain which versions of gradle-plugin and spoon-runner should be used in order to work with gradle 4.0?

@vasdeepika
Copy link

I think there is no official release from Square yet. But It starts working for me after I updated spoon client version and runner to 2.0.0-SNAPSHOT and used the below plugin.
classpath "com.github.dweebo:spoon-gradle-plugin:5c318830a43c01dc098b745278168e12fb55dedc"
For more information Click here

@jaredsburrows
Copy link

I created this Spoon plugin for Gradle that works with Spoon 2.0.0+ and Android Gradle Plugin 3.0.0+ here: https://github.com/jaredsburrows/gradle-spoon-plugin.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants