从外部更改 .apk 资产文件 [英] Change .apk asset file from outside

查看:30
本文介绍了从外部更改 .apk 资产文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个将在很多用户之间分发的 apk 文件.该文件对所有人都是相同的,但我需要为将在代码中使用的每个文件指定 ID(理想情况下,它应该由 php 脚本自动完成).现在我尝试将 ID 放入 Assets 中的文本文件,然后在 Windows 中打开 apk 作为存档,更新文本文件中的值然后保存(更新存档).结果我的应用程序无法再安装.为什么它不起作用?或者可能有另一种方法来为每个 apk 设置 ID,而无需在开发环境中重新创建包?

I have apk file that will be distributed between a lot of users. The file is same for all but I need to specify ID for each one that will be used in code (ideally it should be done automatically by php script). For now I tried to put ID to text file in Assets and then open apk as archive in Windows, update value in text file then save (update archive). As result my application cannot be installed anymore. Why it doesn't work? Or may be there another way to set ID for each apk without recreating package in development environment?

推荐答案

没有办法做到这一点,您必须在每次更改时编译并签署您的应用程序.

There is no way to do that, you must compile and sign your app on every change.

Android 为你的 apk 做一个 hash,如果你稍微改变一下内容,这个 hash 不会重合,不会是一个有效的 apk(无法安装).

Android do a hash for your apk, if you change a bit the content, this hash do not coincide and will not be a valid apk (not able to install).

您可以做一些脚本来自动更改文件并在您的 apk 之后编译/签名.

You can do somewhat script to automatize the change of a file and compile/sign after your apk.

这篇关于从外部更改 .apk 资产文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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