我有一个包含各种子模块的Android Maven项目(我们称之为parent_project):my_library_project,app_using_my_library_project,test_project和extra_lib.
所以,结构将是这样的:
parent_project
* my_library_project (Android Library Project)
* app_using_my_library_project (Demo app that uses the Android Library Project)
* test_project (Project containing the tests instrumented against app_using_my_library_project)
* extra_lib
Run Code Online (Sandbox Code Playgroud)
我想要的是使用Maven为我的Android项目生成测试覆盖率(而不是Ant,我已经能够使用Ant生成代码覆盖率报告,遵循这些说明:https://wiki.jenkins-ci.org/display/ JENKINS/Building + an + Android + app +和+ test + project).
我对使用的代码覆盖工具没有强烈的偏好,但我更喜欢EMMA,因为它似乎是Android开发世界中最常见的.
我在其3.0.0-alpha-12版本中使用android-maven-plugin(http://code.google.com/p/maven-android-plugin/),我已经尝试将我的配置放入父母的pom.xml下一个:
<test>
<coverage>true</coverage>
<createreport>true</createreport>
</test>
Run Code Online (Sandbox Code Playgroud)
但这并不能产生所需的代码覆盖率报告.
所以:
我正在将一个Python应用程序移植到Android,并且在某些时候,该应用程序必须与Web服务进行通信,并向其发送压缩数据.
为此,它使用下一个方法:
def stuff(self, data):
"Convert into UTF-8 and compress."
return zlib.compress(simplejson.dumps(data))
Run Code Online (Sandbox Code Playgroud)
我正在使用下一个方法尝试在Android中模拟此行为:
private String compressString(String stringToCompress)
{
Log.i(TAG, "Compressing String " + stringToCompress);
byte[] input = stringToCompress.getBytes();
// Create the compressor with highest level of compression
Deflater compressor = new Deflater();
//compressor.setLevel(Deflater.BEST_COMPRESSION);
// Give the compressor the data to compress
compressor.setInput(input);
compressor.finish();
// Create an expandable byte array to hold the compressed data.
// You cannot use an array that's the same size as the orginal because
// there …Run Code Online (Sandbox Code Playgroud)