是否可以添加特定的文件pssed到的Andr​​oid APK使用的build.xml uncom $ P $? [英] Is it possible to add specific files uncompressed to a Android APK using build.xml?

查看:98
本文介绍了是否可以添加特定的文件pssed到的Andr​​oid APK使用的build.xml uncom $ P $?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道它可以添加特定的文件中使用的build.xml Ant构建过程pssed到的Andr​​oid APK文件uncom $ P $?我所有的文件都在资产的文件夹,并使用相同的扩展。我也知道我可以使用不同的扩展名,我不希望被添加COM pressed并指定,例如文件:

Does anyone know if its possible to add specific files uncompressed to a Android APK file during the ANT build process using build.xml? All my files live in the assets folder and use the same extension. I do realise that i could use a different extension for the files that i don't want to be added compressed and specify, for example:

<nocompress extension="NoCompress" />

但现在不是我的选择。

but this currently isn't an option for me.

我尝试添加自己的 AAPT添加的的的聘任包后步的步骤在包资源的中的部分的build.xml 的:

I tried adding my own aapt add step after the appt package step in the package-resource section in build.xml:

<exec executable="${aapt}" taskName="add">
<arg value="add" />
<arg value="-v" />
<arg value="${out.absolute.dir}/TestAndroid.ap_" />
<arg value="${asset.absolute.dir}/notcompressed.and" />
</exec>

哪个做了文件添加到APK,但它是COM pressed。 :)

Which did add the file to the APK but it was compressed. :)

这是可能的,或者是不同的扩展名的唯一途径?

Is this possible or is a different extension the only way?

谢谢!

推荐答案

有一个看的这里

的唯一方法(即我发现,写这篇文章的)来控制
  这种行为是通过使用-0(零)标志AAPT上的命令
  线。这个标志,没有任何附带的参数传递,会告诉
  AAPT禁用COM pression为所有类型的资产。通常情况下,你
  不会想使用此选项准确,因为对于大部分资产,
  COM pression是一个可取的事情。然而,有时你将有一个
  特定类型的资产(比如数据库),你不希望
  应用COM pression来。在这种情况下,你有两个选择。

The only way (that I’ve discovered, as of this writing) to control this behavior is by using the -0 (zero) flag to aapt on the command line. This flag, passed without any accompanying argument, will tell aapt to disable compression for all types of assets. Typically you will not want to use this exact option, because for most assets, compression is a desirable thing. Sometimes, however, you will have a specific type of asset (say, a database), that you do not want to apply compression to. In this case, you have two options.

首先,你可以给你的资源文件在上面的列表中的一个延伸。
  虽然这并不一定意义,它可以是一个简单的
  解决方法如果你不想处理在命令行上AAPT。
  另一种选择是将特定的扩展传递给-0标志,如
  为-0分贝,禁止与该扩展资产COM pression。您
  能通过-0标志多次,并且每一次一个独立的
  扩展,如果你需要不止一种类型是uncom pressed。

First, you can give your asset file an extension in the list above. While this does not necessarily make sense, it can be an easy workaround if you don’t want to deal with aapt on the command line. The other option is to pass a specific extension to the -0 flag, such as -0 db, to disable compression for assets with that extension. You can pass the -0 flag multiple times, and each time with a separate extension, if you need more than one type to be uncompressed.

目前,没有方法来传递这些额外的标志时AAPT
  使用Eclipse中的ADT,所以如果你不想牺牲
  易于使用的GUI工具,你将不得不与第一
  选项​​,重命名文件的扩展名。

Currently, there is no way to pass these extra flags to aapt when using the ADT within Eclipse, so if you don’t want to sacrifice the ease of use of the GUI tools, you will have to go with the first option, and rename your file’s extension.

这篇关于是否可以添加特定的文件pssed到的Andr​​oid APK使用的build.xml uncom $ P $?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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