2012-11-28 115 views
13

當我運行我的android UIAutomator代碼時,它顯示以下錯誤。當我運行我的android UIAutomator代碼時,它顯示錯誤

INSTRUMENTATION_RESULT:shortMsg =了java.lang.RuntimeException
INSTRUMENTATION_RESULT:longMsg = com.android.ui.testing
INSTRUMENTATION_CODE:0

我只是跑在developer.android給出的示例代碼.com
如何解決這個錯誤?

登錄下面附:

01-05 01:07:53.559: D/AndroidRuntime(5712): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<< 
01-05 01:07:53.559: D/AndroidRuntime(5712): CheckJNI is ON 
01-05 01:07:53.559: E/AndroidRuntime(5712): cannot open customer xml file 
01-05 01:07:53.559: E/AndroidRuntime(5712): /system/csc/customer.xml can't open file 
01-05 01:07:53.564: D/AndroidRuntime(5712): readGMSProperty: start 
01-05 01:07:53.564: D/AndroidRuntime(5712): readGMSProperty: already setted!! 
01-05 01:07:53.564: D/AndroidRuntime(5712): readGMSProperty: end 
01-05 01:07:53.589: D/dalvikvm(5712): Trying to load lib libjavacore.so 0x0 
01-05 01:07:53.599: D/dalvikvm(5712): Added shared lib libjavacore.so 0x0 
01-05 01:07:53.609: D/dalvikvm(5712): Trying to load lib libnativehelper.so 0x0 
01-05 01:07:53.609: D/dalvikvm(5712): Added shared lib libnativehelper.so 0x0 
01-05 01:07:53.664: I/dalvikvm(5712): Zip is good, but no classes.dex inside, and no valid .odex file in the same directory 
01-05 01:07:53.874: D/dalvikvm(5712): Note: class Landroid/app/ActivityManagerNative; has 152 unimplemented (abstract) methods 
01-05 01:07:53.924: D/AndroidRuntime(5712): Calling main entry com.android.commands.uiautomator.Launcher 
01-05 01:07:53.934: D/AndroidRuntime(5712): Shutting down VM 
01-05 01:07:53.934: W/dalvikvm(5712): threadid=1: thread exiting with uncaught exception (group=0x40ffa2a0) 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): uncaught exception 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): java.lang.RuntimeException: com.uia.example.my.LaunchSettings 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAutomatorTestRunner.java:95) 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutomatorTestRunner.java:82) 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.java:76) 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): at com.android.commands.uiautomator.Launcher.main(Launcher.java:83) 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:237) 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): at dalvik.system.NativeStart.main(Native Method) 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): Caused by: java.lang.ClassNotFoundException: com.uia.example.my.LaunchSettings 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): at com.android.uiautomator.testrunner.TestCaseCollector.addTestClass(TestCaseCollector.java:83) 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): at com.android.uiautomator.testrunner.TestCaseCollector.addTestClass(TestCaseCollector.java:71) 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): at com.android.uiautomator.testrunner.TestCaseCollector.addTestClasses(TestCaseCollector.java:52) 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAutomatorTestRunner.java:92) 
01-05 01:07:53.939: E/UiAutomatorTestRunner(5712): ... 6 more 
01-05 01:07:53.944: I/AndroidRuntime(5712): VM exiting with result code -1. 
+0

你如何運行呢?仿真器?版? –

+0

你需要看logcat的輸出瞭解wher的了java.lang.RuntimeException是。請提供日誌貓輸出。 – Snicolas

+0

你有沒有想過這個?我有同樣的問題,並試圖在這個頁面上的所有答案沒有運氣。我正在嘗試使用Eclipse導出來創建jar文件。 – onetwopunch

回答

1

看看去除@UiThreadTest註釋或刪除runOnUiThread()調用或重新分解你的測試工作。但沒有logcat,很難理解它來自哪裏。

-1

我通過使用「Ant構建」創建我jar.If u使用出口在Eclipse中創建一個JAR文件,可能有一些誤差產生的類文件,因此沒有發現上面的類的錯誤解決了這個錯誤。

3

如果你得到一個ClassNotFindException同時運行您uiautomator測試:

,因爲他們把ROM文件夾/數據/達爾維克緩存只讀模式我們中有些人我得到這個錯誤。 S3發生在我身上的是Cyanogen。

在這種情況下類型,在bash:

adb shell 
su 
chmod 777 /data/dalvik-cache 
exit 

重新運行測試,並應工作。由於應用程序的dalvik-cache被鎖定,uiautomator不能要求dalvik解壓縮測試的jar,而dalvik不會找到它的類。

0

有同樣的問題。我見過的大多數演示表明將jar安裝到/ data/local/tmp /。我見過其他人表示嘗試將其安裝到您的SD卡(/ storage/sdcard0)。這樣做後,它的工作。似乎是讀取權限的問題。

相關問題