标记 Android APK 文件

发布于 2024-09-15 14:48:39 字数 67 浏览 3 评论 0原文

是否有工具或应用程序可用于使用运行时可查询的唯一编号来标记 Android .APK 文件(在下载之前在我的服务器上)?

Is there a tool or application that I can use to stamp Android .APK files (on my server, before a download) with a unique number that is queryable at runtime?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

甚是思念 2024-09-22 14:48:39

更简单的方法是使用手机的识别号:

如何查找Android 设备的序列号?

A much simpler approach would be to use the phone's identification number:

How to find serial number of Android device?

隐诗 2024-09-22 14:48:39

您必须在编译为 apk 之前执行此操作,这意味着您可以随心所欲地执行此操作!使用版本代码或 res/values 中的变量。在签名/压缩对齐后,无法对已编译(已准备好交付)的 apk 执行此操作。

You'll have to do it before you compile to a apk, which means you can do it however you like! Use the version code, or a variable in res/values. There is no way to do it to an apk you've already compiled (that is ready to be shipped) after it has been signed/zipaligned.

油饼 2024-09-22 14:48:39

我想唯一的选择是为您的应用程序使用自定义 Ant 构建。然后,您可以在每次将 APK 发送给用户时构建该 APK,并将该唯一编号注入到代码或资源文件中。不过,这会消耗大量服务器的 CPU。

更新:
apktool 对于这种情况也可能很有用 http://code.google.com/p /android-apktool/
但我不确定这是否会消耗比从头开始构建更少的资源。

I guess the only option is to use custom Ant build for you app. Then you can build the APK every time you ship it to user, injecting that unique number to the code or resource file. This can eat pretty much of your server's CPU though.

UPD:
Also probably the apktool can be useful for the case http://code.google.com/p/android-apktool/
but I'm not sure if that will eat less resources then building from a scratch.

著墨染雨君画夕 2024-09-22 14:48:39

.apk 只是一个 zip 文件,因此您可以使用任何 zip 工具。但是,您需要对 .apk 进行重新签名并在对其进行任何更改后重新运行 zipalign,

An .apk is just a zip file, so you can use any zip tools. However, you will need to re-sign the .apk and re-run zipalign after making any changes to it,

赴月观长安 2024-09-22 14:48:39

我认为最有效的方法是将数据文件添加到已构建的 apk 中。然后仅签署该文件 + 清单。我认为这需要几毫秒的时间,所以你可以“即时”执行此操作。

不幸的是,我怀疑是否有一种工具只能对选定的文件进行签名,您需要编写一个工具。

I think most efficient way is to add a data file to already built apk. Then sign only that one file + manifest. It will take milliseconds, I think, so you could do this "on the fly".

Unfortunately I doubt there is a tool to sign selected files only, you would need to write one.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文