我在为 android 应用程序使用自动化脚本时遇到问题
我正在使用 ant 构建工具来获取我的应用程序的 apk(我有 64 k 方法的问题,所以我使用了 ant 方法)
Apk 在具有手动测试的真实设备中运行良好,但是当我们使用 junit 或 calabash 等自动化脚本运行 apk 时,我得到了 ClassNotFoundException。
请查看我的日志猫以获取更多信息
注意:“SplashActivity”是我的应用程序中的一个活动类。
08-14 09:48:44.626: W/dalvikvm(921): Unable to resolve superclass of Lcom/xxxxxxx/client/android/activities/SplashActivity; (2944)
08-14 09:48:44.626: W/dalvikvm(921): Link of class 'Lcom/xxxxxxx/client/android/activities/SplashActivity;' failed
08-14 09:48:44.665: W/dalvikvm(921): threadid=14: thread exiting with uncaught exception (group=0x40a71930)
08-14 09:48:44.695: I/System.out(921): URI: //ping
08-14 09:48:44.705: E/AndroidRuntime(921): FATAL EXCEPTION: Thread-87
08-14 09:48:44.705: E/AndroidRuntime(921): java.lang.RuntimeException: java.lang.ClassNotFoundException: com.xxxxxxx.client.android.activities.SplashActivity
08-14 09:48:44.705: E/AndroidRuntime(921): at sh.calaba.instrumentationbackend.InstrumentationBackend.getActivity(InstrumentationBackend.java:52)
08-14 09:48:44.705: E/AndroidRuntime(921): at sh.calaba.instrumentationbackend.InstrumentationBackend$1.run(InstrumentationBackend.java:93)
08-14 09:48:44.705: E/AndroidRuntime(921): Caused by: java.lang.ClassNotFoundException: com.xxxxxxx.client.android.activities.SplashActivity
08-14 09:48:44.705: E/AndroidRuntime(921): at java.lang.Class.classForName(Native Method)
08-14 09:48:44.705: E/AndroidRuntime(921): at java.lang.Class.forName(Class.java:217)
08-14 09:48:44.705: E/AndroidRuntime(921): at java.lang.Class.forName(Class.java:172)
08-14 09:48:44.705: E/AndroidRuntime(921): at sh.calaba.instrumentationbackend.InstrumentationBackend.getActivity(InstrumentationBackend.java:49)
08-14 09:48:44.705: E/AndroidRuntime(921): ... 1 more
08-14 09:48:44.705: E/AndroidRuntime(921): Caused by: java.lang.NoClassDefFoundError: com/xxxxxxx/client/android/activities/SplashActivity
08-14 09:48:44.705: E/AndroidRuntime(921): ... 5 more
08-14 09:48:44.705: E/AndroidRuntime(921): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xxxxxxx.client.android.activities.SplashActivity" on path: /system/framework/android.test.runner.jar:/data/app/com.xxxxxxx.client.android.test-1.apk:/data/app/com.xxxxxxx.client.android-1.apk
08-14 09:48:44.705: E/AndroidRuntime(921): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
08-14 09:48:44.705: E/AndroidRuntime(921): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
08-14 09:48:44.705: E/AndroidRuntime(921): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
08-14 09:48:44.705: E/AndroidRuntime(921): ... 5 more