在 Eclipse 中,从 Java 项目访问 Android 项目类
如何在不启动模拟器的情况下执行 Android 项目中的代码块。
我不想处理 android 的生命周期 ->我只想测试我的应用程序的逻辑。
我的想法是创建另一个 java 项目并定义依赖项,以便我可以访问 android 项目中的类。
我想启动一种 Main() 方法来绕过模拟器...可能吗?
谢谢!
How can I execute a block of code in an android project without having to launch the emulator.
I don't want to deal with the android lifcycle -> I want to test the logic of my app ONLY.
What I have in mind is to create another java project and define dependencies so that I can access the classes that are in my android project.
I would like to launch a kind of Main() method to bypass the emulator... Is it possible?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看单元测试。几乎完全适合你的问题。
不完全是针对代码块,而是针对方法。
有一些特殊的启动器,例如 JUnit,可以使测试运行变得更顺畅、更有趣。每次测试你都会得到绿灯和红灯,获得全绿的满足感。
JUnit 相当容易上手,并且很好地集成到 eclipse 中。
Look into unit testing. Fits your problem almost perfectly.
Not exactly for a block of code but for methods.
There are special launchers such as JUnit that makes the test-running smother and much more fun. You get green and red lights for every test, great satisfaction to get all green.
JUnit is fairly easy to get started with and is well integrated into eclipse.