gpt4 book ai didi

android - 有没有办法在不覆盖 build.xml 的情况下生成 ant 文件 local.properties?

转载 作者:IT老高 更新时间:2023-10-28 23:19:29 25 4
gpt4 key购买 nike

我已经为我的 android 项目生成了 ant build.xml,使用 android update project --name <project_name> --target <target_ID> --path path/to/your/project/(根据 http://developer.android.com/guide/developing/other-ide.html )然后修改了我的 build.xml(那里有一些自定义代码)。所以我的 build.xml 在 VCS 中。

但为了执行构建,我需要 local.properties 文件,该文件也是由 android update project 生成的所以 build.xml 会被覆盖。

local.properties 不会被检入 VCS。

有没有办法只生成 local.properties 以便开发人员(或构建服务器)可以检查代码并使用来自 VCS 的 build.xml 构建项目?

谢谢!

最佳答案

不要将 local.properties 放入 VCS:只要它不存在就生成它(例如,在干净 checkout 之后),通过运行

android update project -p .

所以 android 可以使用正确的 sdk 路径生成它。 ant.properties 或 project.properties 旨在放入 VCS,并在每个可能的构建环境中固定您需要的任何内容。

如果您不想修改 build.xml,请将 version-tag 条目更改为与其默认值不同的值,即 1。例如:

<!-- version-tag: custom -->

如果您查看 build.xml 注释,它会说:

 ***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"

关于android - 有没有办法在不覆盖 build.xml 的情况下生成 ant 文件 local.properties?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8790286/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com