我最近更新我的系统从小牛(OSX)优胜美地。我使用的是能够用鼠标右键单击测试并运行它。现在,我得到的异常
I recently updated my system from Mavericks (OSX) to Yosemite. I use to be able to right click on a test and run it. Now I get the exception
/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/java -ea -Didea.launcher.port=7541 "-Didea.launcher.bin.path=/Applications/Android Studio.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/Android Studio.app/Contents/lib/idea_rt.jar:/Applications/Android Studio.app/Contents/plugins/junit/lib/junit-rt.jar:/Users/michael.cameron/Code/Android/sdk/platforms/android-21/android.jar:/Users/michael.cameron/Code/Android/sdk/platforms/android-21/data/res:/Users/michael.cameron/Code/Android/darxstudios/TheChefsCodex/app/build/intermediates/classes/debug:/Users/michael.cameron/Code/Android/darxstudios/TheChefsCodex/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.3/classes.jar:/Users/michael.cameron/Code/Android/darxstudios/TheChefsCodex/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.3/res:/Users/michael.cameron/Code/Android/darxstudios/TheChefsCodex/app/libs/ParseCrashReporting-1.8.0.jar:/Users/michael.cameron/Code/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/21.0.3/support-annotations-21.0.3.jar:/Users/michael.cameron/Code/Android/darxstudios/TheChefsCodex/app/build/intermediates/exploded-aar/com.android.support/support-v4/21.0.3/res:/Users/michael.cameron/Code/Android/darxstudios/TheChefsCodex/app/build/intermediates/exploded-aar/com.android.support/support-v4/21.0.3/classes.jar:/Users/michael.cameron/Code/Android/darxstudios/TheChefsCodex/app/build/intermediates/exploded-aar/com.android.support/support-v4/21.0.3/libs/internal_impl-21.0.3.jar:/Users/michael.cameron/Code/Android/darxstudios/TheChefsCodex/app/libs/Parse-1.8.0.jar:/Users/michael.cameron/.gradle/caches/modules-2/files-2.1/com.parse.bolts/bolts-android/1.1.4/129874135e6081269ace2312092031558865de12/bolts-android-1.1.4.jar:/Users/michael.cameron/Code/Android/darxstudios/TheChefsCodex/app/libs/bolts-android-1.1.4.jar" com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 com.darxstudios.thechefscodex.ApplicationTest
Exception in thread "main" java.lang.NoClassDefFoundError: junit/textui/ResultPrinter
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:191)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:116)
Caused by: java.lang.ClassNotFoundException: junit.textui.ResultPrinter
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 3 more
这可能也与当我挖掘我的码头开放的Android Studio图标我没有得到任何JVM发现错误,但我可以通过终端打开它没有问题。
it may also be related to when i tap the open Android Studio icon in my Dock i get the error no JVM was found but i can open it via Terminal no problem.
这是一样的默认applicationTest试图运行一个全新的机器人工作室的项目。
This is the same as a brand new android studio project with the default applicationTest trying to run.
所以两件事
首先,如果你试图打开Android Studio中的优山美地升级,它说没有找到JVM你需要安装java 6 OSX的此处由于Android需要Java 1.6和Java的不是1.6 +
First, if you try to open Android Studio on Yosemite upgrade and it says "No JVM found" you need to install the java 6 for osx here as Android requires java 1.6 and not java 1.6+.
第二,我发现了异常被造成的,因为它试图运行JUnit,如果我想通过Java标准控制台,而不是与Android运行。
Second, The Exception I found was caused because it was trying to run JUnit as if I wanted to run through java standard console instead of with Android.
不要使用Java测试包含一个黑色的箭头,使用Android的测试中的单元测试,并删除了JUnit配置的所有用途。
Do not use the Java test that contains a black with arrows, use the unit tests within a Android Tests and delete all uses of the JUnit configuration.
您的配置应该是这样的,那么你可以用鼠标点击一个测试,并像正常运行。
Your configuration should look like this, then you can right click on single tests and run them like normal.