如何构建安卓APK当参数传递给AAPT? [英] How to pass arguments to aapt when building android apk?

查看:249
本文介绍了如何构建安卓APK当参数传递给AAPT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建用蚂蚁在Linux上(没有使用Eclipse)的apk文件,我试图找到一个简单的方法来COM pressing的资产,而不是之间切换,以保持我的庞大的数据库uncom pressed为< 2.3。根据这篇文章:

I'm building an apk using ant on Linux (not using Eclipse), and I'm trying to find an easy way to switch between compressing assets and not, in order to keep my huge database uncompressed for < 2.3. As per this article:

http://ponystyle.com/blog/2010/03/26/dealing-with-asset-com$p$pssion-in-android-apps/

我看到它是可以通过指定类似于 AAPT -0分贝要做到这一点,但我不能找到如何编辑与AAPT蚂蚁互动方式的信息。还是我必须运行AAPT本身?我该怎么办?

I see that it's possible to do this by specifying something like aapt -0 db, but I can't find information on how to edit the way ant interacts with aapt. Or do I have to run aapt by itself? What do I do?

推荐答案

这是Android的build.xml文件(你会发现这下你的SDK,工具和蚂蚁),建设时执行AAPT。

It's Android's build.xml (you'll find this under your SDK, tools and ant) that executes AAPT when building.

找到你的build.xml文件,并与下面的目标取代-package - 资源的目标。我是pretty的肯定(不能在此刻进行测试),你能COM型开关pression打开和关闭两种-Dcom pression.disabled =设置时,建立与ANT或COM pression.disabled =设置,在您的.properties文件。

Find your build.xml and replace the "-package-resources" target with the target below. I'm pretty sure (not able to test it at the moment) you'd be able to swith compression on and off with either "-Dcompression.disabled=set" when build with ANT or "compression.disabled=set" in your .properties-file.

<target name="-package-resources" depends="-crunch">
    <!-- only package resources if *not* a library project -->
    <do-only-if-not-library elseText="Library project: do not package resources..." >
        <aapt executable="${aapt}"
                command="package"
                versioncode="${version.code}"
                versionname="${version.name}"
                debug="${build.is.packaging.debug}"
                manifest="AndroidManifest.xml"
                assets="${asset.absolute.dir}"
                androidjar="${android.jar}"
                apkfolder="${out.absolute.dir}"
                nocrunch="${build.packaging.nocrunch}"
                resourcefilename="${resource.package.file.name}"
                resourcefilter="${aapt.resource.filter}"
                projectLibrariesResName="project.libraries.res"
                projectLibrariesPackageName="project.libraries.package"
                previousBuildType="${build.last.target}"
                buildType="${build.target}">
            <res path="${out.res.absolute.dir}" />
            <res path="${resource.absolute.dir}" />
            <if>
                <condition>
                    <isset property="compression.disabled" />
                </condition>
                <then>
                    <nocompress/>
                </then>
            </if>
        </aapt>
    </do-only-if-not-library>
</target>

这篇关于如何构建安卓APK当参数传递给AAPT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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