将下面这段配置放到build.gradle中: testImplementation "org.json:json:20140107" 原因是:JSONObject是Android的SDK,测试环境当中没有。