在客户端手机上签名APK
这是我在 StackOverflow 上的第一个问题,我的英语很差,所以请:D。我这样做只是为了好玩。我想更改每个用户的图标,让用户更改应用程序的图标。我想如果我想这样做,我必须阅读apk本身,解压缩它,更改chedrawable/icon.png并重建它,最后签名。 我尝试了一些代码,但失败了。导入原因是,package sun.securate.*
不在 Android Java 框架中。我写了一些代码来做到这一点,但失败了-_- 谁能帮助我?我可以分享我已经写好的代码。 请帮助我!
This is my first question on StackOverflow, and my english is poor, so please :D. I do this just for fun. I want to change the icon per user, letting users change the icon of the app. I think if I want to do this, I must read the apk self, unzip it, change che drawable/icon.png and rebuild it, at last to sign.
I try some code, but failed. The import reason is that, package sun.securate.*
is not in Android Java framework. I write some code to do this, but it failed-_-
Who can help me? I can share my already written code.
Help me,Please!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
另一个解决方法是为主屏幕创建快捷方式图标,该图标启动与启动器相同的活动。这样,抽屉中的启动器图标将是实际的图标,但在主屏幕上您将有不同的图标。如果您知道软件包信息,您还可以探索为其他应用程序创建快捷方式的想法。
参考:
有关软件包信息,请参阅 doc 。
创建快捷方式的代码片段如下(仅用于说明):
如果您只想让用户更改应用程序图标,为什么不从 SD 卡加载图标。如果用户未指定图标,则随包裹一起提供的图标将会出现。
这是可以帮助您的片段。
如果这不起作用,请尝试在
setContentView
之前调用setFeatureDrawable
Well another work around will be to create shortcut icon for Home Screen which launches the same Activity as the launcher. With this your launcher icon in drawer will be the actual one but on the home screen you will have different icon. You can also explore the idea of creating shortcut for other apps if you know the package info.
Ref:
For package info here are the doc.
For creating short cut here is the snippet (this is just for illustration):
If you just want user to change the app icon, why dont you load the icon from the SD card. And the icon that you ship with your package will be there if no icon is specified by user.
Here is the snippet that can help you.
If this does not work, try calling
setFeatureDrawable
beforesetContentView
您无法更改已签名并密封的 APK 的启动器图标,除非通过软件升级。
You cannot change the launcher icon of a signed-and-sealed APK, except through a software upgrade.