与Robolectric和摇篮(安卓工作室)的Andr​​oid项目 [英] Android project with Robolectric and Gradle (Android studio)

查看:129
本文介绍了与Robolectric和摇篮(安卓工作室)的Andr​​oid项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用Robolectric在项目建设与摇篮里新的IDE为Android:Android的工作室,但我面临着一个奇怪的问题,我已经正确导入所有的图书馆,并建立了测试的文件夹里面的SRC,但事实是,每当我运行的测试的IDE一直说类未找到:com.example.myandroidproject.test我在做什么错了,我需要改变某些事情了gradle.build?这里是我的目录结构:

I'm trying to use Robolectric in a project build with gradle inside the new Ide for android: Android studio, but I'm facing a strange problem, I've correctly imported all the libraries and created the "test" folder inside "src", the fact is that whenever I run the tests the ide keep saying "Class not found: "com.example.myandroidproject.test" what I'm doing wrong? i need to change something in the gradle.build? here's my directory structure:

推荐答案

这是不太可能的工作开箱即用的SRC /测试不会自动使用。 你需要来编译该源集自动创建一个测试任务,树立正确的依存关系和运行它。

This is unlikely to work out of the box as src/test isn't used automatically. You'd need to create a test task automatically that compiles this source sets, sets the right dependencies and run it.

我们打算支持这个在未来,但现在你需要手动执行此操作。

We intend to support this in the future but right now you'd need to do this manually.

这篇关于与Robolectric和摇篮(安卓工作室)的Andr​​oid项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆