Skip to content
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

Unable to run JUnit tests with Android Studio 3.3 #71

Open
igorwojda opened this issue Dec 7, 2018 · 9 comments
Open

Unable to run JUnit tests with Android Studio 3.3 #71

igorwojda opened this issue Dec 7, 2018 · 9 comments

Comments

@igorwojda
Copy link

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
Copy link

m-maillot commented Jan 16, 2019

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
Copy link
Author

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)

@igorwojda igorwojda changed the title Unable to run JUnit tests with Android Studio 3.3RC2 Unable to run JUnit tests with Android Studio 3.3 Jan 16, 2019
@m-maillot
Copy link

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
Copy link
Owner

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

@iTomkinas
Copy link

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
Copy link
Owner

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

@eskfung
Copy link

eskfung commented Jan 25, 2019

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

This build seems to have solved my problems. Thanks!

@raniejade
Copy link
Owner

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

@raniejade
Copy link
Owner

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.

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

No branches or pull requests

5 participants