我所做的步骤
- Downloaded Runner JAR and Client JAR from Square
- Copied
spoon-client-1.1.2.jar
to the libs folder, right click --> Add As Library... wrote a simple dummy test:
public MainActivityTest() { super(MainActivity.class); } public void test() { Spoon.screenshot(getActivity(), "initial_state"); }
Ran MainActivity
Ran MainActivityTest (Tests passed)
Copied
app-debug.apk
andapp-debug-androidTest-unaligned.apk
from the project to the same folder as thespoon-runner-1.1.2-jar-with-dependencies.jar
CMD -> switched to the folder where I put the three files
Executed
java -jar spoon-runner-1.1.2-jar-with-dependencies.jar --apk app-debug.apk --test-apk app-debug-androidTest-unaligned.apk
输出: 在主线程中出现异常:java.lang.NullPointerException: 未指定SDK路径。位于com.google.common.base.Preconditions.checkNotNull<Preconditions.java:226> com.squareup.spoon.SpoonRunner$Builder.setAndroidSdk<SpoonRunner.java:228> com.squareup.spoon.SpoonRunner.main>SpoonRunner.java:437
SDK位于C:\Users\myUser\AppData\Local\Android\Sdk
,我可以在文件 -> 项目结构 -> SDK位置(Android Studio)下看到该路径。
发生了什么问题?