Android 单元测试 Error: ShouldNotReachHere()

拿手机调试是在是太麻烦,试下单元测试

使用junit, 创建单元测试见http://www.ideasandroid.com/archives/301

 

运行前出现如下错误

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (classFileParser.cpp:3174), pid=4424, tid=3868
#  Error: ShouldNotReachHere()
#
# JRE version: 6.0_18-b07
# Java VM: Java HotSpot(TM) Client VM (16.0-b13 mixed mode windows-x86 )
# An error report file with more information is saved as:
# D:\Eclipse\google code\*****\hs_err_pid4424.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#

 后google后解决

1、右击项目名->Run As->Run configurations

2、选择Classpath,删除Bootstrap Entries中的Android*


Android 单元测试 Error: ShouldNotReachHere()_第1张图片

 

3、选择Advanced->Add Library。增加 JRE System Library和JUnit 后,Run即可


Android 单元测试 Error: ShouldNotReachHere()_第2张图片
 
参考:

你可能感兴趣的:(android)