我在APK中使用以下命令调用基于UiAutomator的测试脚本:
proc = java.lang.Runtime.getRuntime().exec("uiautomator runtest Library.jar -c com.uia.example.my.Library");在洛杉矶之前一切都很顺利。但是在MOS中,我得到了以下错误:
无法取消链接/data/local/tmp/dalvik-cache/arm64/sdcard@data@Library.jar@classes.dex:权限被拒绝
请提供这个问题的解决方案。
注意:我需要以二进制版本运行脚本。所以生根是不可能的。
发布于 2015-10-21 03:20:22
使用Android测试支持库,并创建一个扩展InstrumentationTestCase的测试用例,如测试多个应用程序的UI中所解释的那样。
然后使用
$ ./gradlew connectedCheck发布于 2015-12-07 01:02:16
这个问题是由于您放置Library.jar文件的/data/local/tmp/中没有写权限造成的。从罐子中提取dex需要有写权限。
可能是原始设备制造商可以禁用根并删除对/data/local/tmp的写权限,这可能是您在生产/发行版构建中出现问题的原因。
如果您使用uiautomator命令,如: uiautomator运行测试Library.jar ..。在默认情况下,uiautomator将在/data/local/tmp中搜索Library.jar。您可以检查/system/bin中的uiautomator shell脚本。导出run_base=/data/local/tmp ==> Classpath,用于搜索dex文件。
一种解决方案是将Library.jar和修改后的uiautomator脚本放置在应用程序文件夹(data/data//file)中。您必须使用应用程序数据文件夹路径修改run_base。
您可以按照以下链接中的说明捆绑uiautomator脚本和jar:http://gimite.net/en/index.php?Run%20native%20executable%20in%20Android%20App
希望能帮上忙..。请更新您的结果。
https://stackoverflow.com/questions/33230113
复制相似问题