替换/重建Android源中的framework.jar

发布于 2024-12-08 12:27:32 字数 472 浏览 0 评论 0原文

这可能是一个相当疯狂的问题,但在我花所有时间尝试之前,我想先了解一下它。

是否可以重建framework.jar(比如从MIUI中提取framework.jar),将其反编译为smali,然后从头开始重建(通过阅读并将其重新制作为java)?

我计划这样做+将 Cyanogen mod 中的类似文件作为构建的参考。我对做这一切感兴趣的原因是因为我有一部手机或多或少需要重建无线电接口层,并且直接编辑 smali 并调试它变得太麻烦了。

我想我会在这里问,因为人们不会那么急于判断这是否可能。我不明白为什么如果您正确添加所有内容(理论上)并在源代码中重建classes.dex 文件,它就不起作用。

我问这个问题的主要原因是将 MIUI 移植到我的手机上。我认为更令人头疼的事情是重写 java 并重建工作的 Framework.jar(其中包含 CM7 或 AOSP 源代码中没有的部分),而不是编辑 MIUI 附带的 Framework.jar 以使其正常工作。

This could be a rather crazy question, but I wanted to get some insight on it before I spend all the time trying it.

Is it possible to rebuild framework.jar (like say pulling the framework.jar from MIUI), decompile it to smali and then rebuilt it from scratch (via reading through and remaking it yourself into java)?

I planned on doing that + taking the similar files from Cyanogen mod as a reference to build off of. The reason I was interested in doing all this was because I have a phone that needs the Radio Interface Layer more or less rebuilt and it's just become too much of a hassle to deal with editing the smali directly and debugging it.

I figured I would ask here because people would be less quick to rush to judgment on whether it was possible or not. I don't see why it wouldnt work if you are adding everything correctly (in theory) and rebuilt the classes.dex file in the source after.

Main reason I am asking is part of an effort to port MIUI to my phone. I figured the lesser of too headaches was rewriting the java and rebuilding a working framework.jar (which has parts in it that are not in the CM7 or AOSP sources) than editing the framework.jar that comes with MIUI to work correctly.

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

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

发布评论

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

评论(1

鲸落 2024-12-15 12:27:32

虽然有多种方法可以将 dex 文件反编译回 java,但没有一种方法可以生成完全可编译的 java。您必须花费大量的精力从反编译器中清理Java代码,才能对其进行编译。对于这么大的事情来说,这几乎不是一个选择。

最好的选择是让 AOSP 或 CM 之类的东西在你的手机上运行,​​这样你就可以直接自己构建框架,并进行任何你需要的修改。

While there are various ways to decompile a dex file back into java, none of them will produce java that is perfectly compilable. You would have to spend tons of effort cleaning up the java code from a decompiler, to get it to compile. It's pretty much not an option for something as big as that.

Your best bet is to get something like AOSP or CM working on your phone, so that you can build the framework yourself directly, with whatever modifications you need.

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