简体   繁体   English

Android开发生命周期设置

[英]Android Development Lifecycle Setup

I've been doing a lot of research to try to set up my development environment to produce highly maintainable code, essentially. 我一直在进行大量研究,以尝试建立我的开发环境以本质上生成高度可维护的代码。 I've found many tools for Java/Android around, and the more I research or try to use more it seems that I end up running around in circles. 我发现了许多用于Java / Android的工具,而我研究或尝试使用的工具越多,看来我最终会四处奔波。 Is there anyone that can give me solid advice on these things? 有没有人可以给我关于这些事情的可靠建议? A lot of my search results are out of date, and/or partial. 我的很多搜索结果都是过时的和/或不完整的。 They at best get me one piece of the set up, but don't work well with each other. 他们充其量只能使我受益匪浅,但彼此之间的配合并不好。

Tools I've tried to integrate into my development: 我尝试集成到开发中的工具:

  • Code Coverage 代码覆盖率
  • TDD TDD
  • Build tools 构建工具
  • Dependency Injection 依赖注入
  • Compatibility libraries 相容性库
  • Continuous Integration 持续集成

I wanted to have a nice MVC structure to my project, with proper scoping of objects, so I discovered Roboguice/Guice and using interfaces/abstract classes to expose the API of the underlying implementation. 我想为我的项目提供一个不错的MVC结构,并具有适当的对象范围,因此我发现了Roboguice / Guice并使用接口/抽象类公开了底层实现的API。 This I got to work fine for me so far, though not for testing yet. 到目前为止,这对我来说还算不错,尽管还没有进行测试。 I need an older-SDK compatible Action Bar, so I was lead to ActionBarSherlock in the Android Office Hours. 我需要一个与SDK兼容的较旧的操作栏,因此在Android Office Hours中使用了ActionBarSherlock。 I can add the Android Library Project fine it seems. 我可以添加Android库项目,看起来不错。

Then I discovered (at least for the current stable version) you have to do some maneuvering to get it to work with Roboguice because of the compatibility library. 然后,我发现(至少对于当前的稳定版本而言)由于兼容库,您必须进行一些调整才能使其与Roboguice一起使用。 The solution pointed to using Maven to handle the dependencies. 该解决方案指出了使用Maven处理依赖关系。 So I look into converting my Android project to a Maven Android project (it's something I was considering doing anyways for the cleaner project dependency management). 因此,我打算将我的Android项目转换为Maven Android项目(无论如何,我一直在考虑这样做,以实现更清洁的项目依赖关系管理)。 Now I believe I have Maven, Android, and Eclipse (yes, I forgot, Eclipse is another variable in this equation) to work together. 现在,我相信我可以将Maven,Android和Eclipse(是的,我忘了,Eclipse是这个方程式中的另一个变量)一起工作。 But now I'm having issues using the ActionBarSherlock library when importing it through an apklib-type dependency as the guide mentions. 但是现在,如本指南所述,在通过apklib类型的依赖关系导入ActionBarSherlock库时,我遇到了问题。 Can't "find symbol: class FragmentActivity" for example. 例如,无法“找到符号:FragmentActivity类”。 I try to make a new Android Library Project with the "target/unpack/apklibs/" Maven produces, but can only get empty Android projects missing an AndroidManifest.xml. 我尝试使用Maven生成的“ target / unpack / apklibs /”创建一个新的Android库项目,但只能得到缺少AndroidManifest.xml的空Android项目。

Then I try to find how I could add code coverage for my testing suite, and I find Emma, EclEmma, and Robotium. 然后,我尝试找到如何为测试套件添加代码覆盖率,然后找到Emma,EclEmma和Robotium。 It seems that those only "work" with Ant builds, in particularly, I've only read things for Emma that seem to require major modifications of the default Android files and build script to support the code coverage reporting. 看来,那些仅与Ant构建有关的“工作”,特别是,我仅阅读了Emma的内容,这些内容似乎需要对默认Android文件和​​构建脚本进行重大修改以支持代码覆盖率报告。 I'm now hesitant to move forward on those because I don't want to destroy my Android development base pursuing old advice, and it requires Ant not Maven, but my earlier work needs Maven. 我现在很犹豫地推进这些工作,因为我不想破坏我的Android开发基础并遵循旧的建议,它需要Ant而不是Maven,但是我以前的工作需要Maven。

I'm hesitant to ask such a question because it seems broad, but they are important tools for developing production code so people must be using them, and I can't seem to figure out how to get a nice subset of them working simultaneously. 我犹豫要问这样一个问题,因为它看起来很广泛,但是它们是开发生产代码的重要工具,因此人们必须使用它们,而且我似乎无法弄清楚如何让它们中的一个很好的子集同时工作。 Is there any experienced advice for this issue? 是否有针对此问题的经验丰富的建议?

This is more of a side note. 这更多是一个旁注。 All tools you are mentioning are wonderful but please remember that all of them come at the cost of adding bulk to your app. 您提到的所有工具都很棒,但是请记住,所有工具都是以增加应用程序体积为代价的。 My rule of thumb is: no more than 150-200K of added weight. 我的经验法则是:增加的重量不超过150-200K。 So I have a tendency to use simple and built-in packages. 因此,我倾向于使用简单的内置软件包。 I get much more mileage on good reusability of my code and I'm really picky about any code repetition. 我对代码的良好可重用性有了更多的了解,并且我对任何代码重复都非常挑剔。 So, refactor, refactor and refactor. 因此,重构,重构和重构。 Eclipse provides wonderful facilities for that Eclipse为此提供了出色的功能

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM