问题
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?
回答1:
There is no way to do that, you must compile and sign your app on every change.
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).
You can do somewhat script to automatize the change of a file and compile/sign after your apk.
来源:https://stackoverflow.com/questions/18918154/change-apk-asset-file-from-outside