问题描述
我试图用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和摇篮(安卓工作室)的Android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!