本文介绍了未指定SDK路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了的步骤

  1. Square
  2. 下载了Runner JAR和Client JAR
  3. spoon-client-1.1.2.jar复制到libs文件夹,右键单击->另存为库...".
  4. 编写了一个简单的虚拟测试:

  1. Downloaded Runner JAR and Client JAR from Square
  2. Copied spoon-client-1.1.2.jar to the libs folder, right click --> Add As Library...
  3. wrote a simple dummy test:

public MainActivityTest() {
    super(MainActivity.class);
}

public void test() {
    Spoon.screenshot(getActivity(), "initial_state");
}

  • Ran MainActivity

  • Ran MainActivity

    Ran MainActivityTest(测试已通过)

    Ran MainActivityTest (Tests passed)

    app-debug.apkapp-debug-androidTest-unaligned.apk从项目复制到与spoon-runner-1.1.2-jar-with-dependencies.jar

    CMD->切换到我放置三个文件的文件夹

    CMD -> switched to the folder where I put the three files

    已执行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中,我可以在以下位置看到路径:文件->项目结构-> SDK位置(Android Studio)

    The SDK is located in C:\Users\myUser\AppData\Local\Android\Sdk and I can see the path under: File -> Project Structure -> SDK Location (Android Studio)

    出了什么问题?

    推荐答案

    Android SDK路径存在问题.但是,指定路径确实可以解决问题.完整的命令如下所示:

    There is a problem with the Android SDK path. However specify the path did the trick. The full command looks like:

    java -jar spoon-runner-1.1.2-jar-with-dependencies.jar --apk app-debug.apk --test-apk app-debug-androidTest-unaligned.apk --sdk C:\Users\myUser\AppData\Local\Android\sdk
    

    这篇关于未指定SDK路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

  • 08-01 08:29