Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经注册了Android Backup Service,并获得了一个密钥,可以放入我的 AndroidManifest.xml。我的应用程序是开源的,但我不想让密钥在我的存储库中公开可见。我应该如何加密密钥,以便只能在我的应用程序中解密?
我的应用程序是开源的,但我不想让密钥在我的存储库中公开可见。
将密钥放在字符串资源中,放在单独的资源文件中(例如,res/values/omg_do_not_commit_this_to_the_repo.xml)。然后,不要将该文件提交到 repo(例如,如果您使用 Git,请将文件添加到.gitignore)。
res/values/omg_do_not_commit_this_to_the_repo.xml
.gitignore
AndroidManifest.xml不支持对您的密钥进行任何形式的加密。您不应该将其签入公共存储库以防止其被共享
AndroidManifest.xml