我做的步骤
- 从Square下载 Runner JAR 和 Client JAR
- 复制
spoon-client-1.1.2.jar
到libs文件夹,右键-->添加为库... 写了一个简单的虚拟测试:
public MainActivityTest() { super(MainActivity.class); } public void test() { Spoon.screenshot(getActivity(), "initial_state"); }
跑 MainActivity
Ran MainActivityTest(测试通过)
复制
app-debug.apk
并app-debug-androidTest-unaligned.apk
从项目中复制到与spoon-runner-1.1.2-jar-with-dependencies.jar
CMD -> 切换到我放三个文件的文件夹
执行
java -jar spoon-runner-1.1.2-jar-with-dependencies.jar --apk app-debug.apk --test-apk app-debug-androidTest-unaligned.apk
输出: Exception in thread "main" java.lang.NullPointerException: SDK path not specified. at com.google.common.base.Preconditions.checkNotNull<Preconditions.java:226> at com.squareup.spoon.SpoonRunner$Builder.setAndroidSdk<SpoonRunner.java:228> at com.squareup.spoon.SpoonRunner.main>SpoonRunner.java:437>
SDK位于C:\Users\myUser\AppData\Local\Android\Sdk
,我可以在下面看到路径:File -> Project Structure -> SDK Location (Android Studio)
什么地方出了错?