我想知道如何在Robotium的AVD上截屏。我已經讀過,我必須有權限,但我已經做到了。如何在Robotium中創建屏幕截圖
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
但我依然有錯誤在Android監視器
D/Robotium: Can't save the screenshot! Requires write permission (android.permission.WRITE_EXTERNAL_STORAGE) in AndroidManifest.xml of the application under test.
W/System.err: java.io.FileNotFoundException: /sdcard/Screenshot/asd.jpg: open failed: EACCES (Permission denied)
我手動創建的目錄,確保目錄存在。
我也試圖採取截圖我的磁盤
String path = "/sdcard/SS";
solo.getConfig().screenshotSavePath = path;
solo.takeScreenshot("asd");
path = "C:/";
solo.getConfig().screenshotSavePath = path;
solo.takeScreenshot("asd");
但錯誤依然存在的。採取截圖有什麼問題?
[Android的,Robotium - 問題採取截圖]的可能的複製(http://stackoverflow.com/questions/8819542/android-robotium-issue-taking-screenshot) – piotrek1543
檢查上面的鏈接 – piotrek1543