raniejade / spek-idea-plugin

MIT License
48 stars 15 forks source link

Unable to run JUnit tests with Android Studio 3.3 #71

Open igorwojda opened 5 years ago

igorwojda commented 5 years ago

As a result for this crash we can't start any test from IDe (including pure JUnit test) image

Just create a new project in AS 3.3RC1 and try to run test having Spek plugin installed

Crash:

java.lang.NoClassDefFoundError: com/android/tools/idea/run/PreferGradleMake
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
    at com.intellij.util.lang.UrlClassLoader._defineClass(UrlClassLoader.java:278)
    at com.intellij.util.lang.UrlClassLoader.defineClass(UrlClassLoader.java:274)
    at com.intellij.util.lang.UrlClassLoader._findClass(UrlClassLoader.java:243)
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClassInsideSelf(PluginClassLoader.java:147)
    at com.intellij.ide.plugins.cl.PluginClassLoader.tryLoadingClass(PluginClassLoader.java:74)
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:61)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.jetbrains.spek.studio.SpekAndroidConfigurationFactory.createTemplateConfiguration(SpekAndroidConfigurationFactory.kt:15)
    at com.intellij.execution.actions.RunConfigurationProducer.createLightConfiguration(RunConfigurationProducer.java:241)
    at com.intellij.execution.lineMarker.ExecutorAction$Companion.computeConfigurations(ExecutorAction.kt:61)
    at com.intellij.execution.lineMarker.ExecutorAction$Companion.getConfigurations(ExecutorAction.kt:46)
    at com.intellij.execution.lineMarker.ExecutorAction$Companion.access$getConfigurations(ExecutorAction.kt:31)
    at com.intellij.execution.lineMarker.ExecutorAction.getActionName(ExecutorAction.kt:94)
    at com.intellij.execution.lineMarker.ExecutorAction.update(ExecutorAction.kt:71)
    at com.intellij.execution.lineMarker.LineMarkerActionWrapper.update(LineMarkerActionWrapper.java:84)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareUpdate(ActionUtil.java:171)
    at com.intellij.openapi.actionSystem.impl.Utils.doUpdate(Utils.java:256)
    at com.intellij.openapi.actionSystem.impl.Utils.expandActionGroup(Utils.java:199)
    at com.intellij.openapi.actionSystem.impl.Utils.fillMenu(Utils.java:350)
    at com.intellij.openapi.actionSystem.impl.ActionPopupMenuImpl$MyMenu.show(ActionPopupMenuImpl.java:110)
    at com.intellij.openapi.editor.impl.EditorGutterComponentImpl.invokePopup(EditorGutterComponentImpl.java:1875)
    at com.intellij.openapi.editor.impl.EditorGutterComponentImpl.mousePressed(EditorGutterComponentImpl.java:1630)
    at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.processMousePressed(EditorImpl.java:3763)
    at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.lambda$runMousePressedCommand$0(EditorImpl.java:3629)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:139)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:97)
    at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.runMousePressedCommand(EditorImpl.java:3634)
    at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.mousePressed(EditorImpl.java:3565)
    at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:280)
    at java.awt.Component.processMouseEvent(Component.java:6545)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
    at java.awt.Component.processEvent(Component.java:6313)
    at java.awt.Container.processEvent(Container.java:2237)
    at java.awt.Component.dispatchEventImpl(Component.java:4903)
    at java.awt.Container.dispatchEventImpl(Container.java:2295)
    at java.awt.Component.dispatchEvent(Component.java:4725)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4523)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
    at java.awt.Container.dispatchEventImpl(Container.java:2281)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4725)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
    at java.awt.EventQueue$4.run(EventQueue.java:737)
    at java.awt.EventQueue$4.run(EventQueue.java:735)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:817)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:754)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:394)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.ClassNotFoundException: com.android.tools.idea.run.PreferGradleMake PluginClassLoader[org.jetbrains.spek.spek-idea-plugin, 0.5.5-studio3.0] com.intellij.ide.plugins.cl.PluginClassLoader@7f883643
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:63)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 66 more
m-maillot commented 5 years ago

Same for the stable version 3.3 and the plugin version 2.0.0-rc.1.170+fe27af0-Studio3.3

My bug was on the Spek Framework plugin for the version 2 :)

igorwojda commented 5 years ago

AS 3.3 Spek Version: 0.5.5-studio3.0 Spek Framework Version: 2.0.0-rc.1.170+fe27af0-Studio3.3

java.lang.NoClassDefFoundError: org/jetbrains/spek/studio/SpekAndroidRunConfiguration
    at org.jetbrains.spek.studio.SpekAndroidConfigurationFactory.createTemplateConfiguration(SpekAndroidConfigurationFactory.kt:15)
    at com.intellij.execution.actions.RunConfigurationProducer.createLightConfiguration(RunConfigurationProducer.java:241)
    at com.intellij.execution.lineMarker.ExecutorAction$Companion.computeConfigurations(ExecutorAction.kt:61)
    at com.intellij.execution.lineMarker.ExecutorAction$Companion.getConfigurations(ExecutorAction.kt:46)
    at com.intellij.execution.lineMarker.ExecutorAction$Companion.access$getConfigurations(ExecutorAction.kt:31)
    at com.intellij.execution.lineMarker.ExecutorAction.getActionName(ExecutorAction.kt:94)
    at com.intellij.execution.lineMarker.ExecutorAction.update(ExecutorAction.kt:71)
    at com.intellij.execution.lineMarker.LineMarkerActionWrapper.update(LineMarkerActionWrapper.java:84)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareUpdate(ActionUtil.java:171)
    at com.intellij.openapi.actionSystem.impl.Utils.doUpdate(Utils.java:256)
    at com.intellij.openapi.actionSystem.impl.Utils.expandActionGroup(Utils.java:199)
    at com.intellij.openapi.actionSystem.impl.Utils.fillMenu(Utils.java:350)
    at com.intellij.openapi.actionSystem.impl.ActionPopupMenuImpl$MyMenu.show(ActionPopupMenuImpl.java:110)
    at com.intellij.openapi.editor.impl.EditorGutterComponentImpl.invokePopup(EditorGutterComponentImpl.java:1875)
    at com.intellij.openapi.editor.impl.EditorGutterComponentImpl.mousePressed(EditorGutterComponentImpl.java:1630)
    at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.processMousePressed(EditorImpl.java:3763)
    at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.lambda$runMousePressedCommand$0(EditorImpl.java:3629)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:139)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:97)
    at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.runMousePressedCommand(EditorImpl.java:3634)
    at com.intellij.openapi.editor.impl.EditorImpl$MyMouseAdapter.mousePressed(EditorImpl.java:3565)
    at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:280)
    at java.awt.Component.processMouseEvent(Component.java:6545)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
    at java.awt.Component.processEvent(Component.java:6313)
    at java.awt.Container.processEvent(Container.java:2237)
    at java.awt.Component.dispatchEventImpl(Component.java:4903)
    at java.awt.Container.dispatchEventImpl(Container.java:2295)
    at java.awt.Component.dispatchEvent(Component.java:4725)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4523)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
    at java.awt.Container.dispatchEventImpl(Container.java:2281)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4725)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
    at java.awt.EventQueue$4.run(EventQueue.java:737)
    at java.awt.EventQueue$4.run(EventQueue.java:735)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:817)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:754)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:394)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
m-maillot commented 5 years ago

A new version 2.0.0-rc.1.180+b8533a4-Studio3.3 has been published and waiting the Jetbrains approval (https://kotlinlang.slack.com/archives/C0BE6KSRW/p1547631046024800?thread_ts=1547630740.024000&cid=C0BE6KSRW)

raniejade commented 5 years ago

I'll look into it this coming weekend, hopefully I don't need to do anything big.

iTomkinas commented 5 years ago

I had the same problem with android studio 3.3, but it seems that in android studio preview 3.4 this is issue is fixed

raniejade commented 5 years ago

Can you guys test out the build mentioned here? https://github.com/spekframework/spek/issues/571#issuecomment-455768428

eskfung commented 5 years ago

Can you guys test out the build mentioned here? spekframework/spek#571 (comment)

This build seems to have solved my problems. Thanks!

raniejade commented 5 years ago

Good to hear, I'll publish the build to the proper channels later.

raniejade commented 5 years ago

I had the same problem with android studio 3.3, but it seems that in android studio preview 3.4 this is issue is fixed

Prior to AS3.3 the android plugin was present in the classpath of every plugin, but on AS3.3 it was changed and you have to explicitly request it in the plugin.xml file. The change may or may not be intentional, but I think in AS3.4 it was reverted back to the old behaviour.