java 如何在 Android Studio 中编辑 .jar 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29478227/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 15:21:20  来源:igfitidea点击:

How to edit .jar file in Android Studio

javaandroidjarandroid-studiolibs

提问by Taylor Courtney

How can I edit code in a .class file in a .jar file using Android Studio? I have already tried to edit it of course. The class I am trying to edit is a read only for some reason.

如何使用 Android Studio 在 .jar 文件中的 .class 文件中编辑代码?我当然已经尝试过编辑它。由于某种原因,我试图编辑的课程是只读的。

回答by noob

Jarfiles are compressed archives (zipped files) of .classfiles( and few other resources). .classfiles are compiled .javafiles. You can not edit a compiled file in normal situation unless you decompile to get source code, edit the code and recompile again.

Jar文件是.class文件(和一些其他资源)的压缩档案(压缩文件)。.class文件是编译后的.java文件。正常情况下你不能编辑一个编译好的文件,除非你反编译得到源代码,编辑代码并重新编译。

Decompiling is a tedious process, thus getting a source code is the best option here.

反编译是一个繁琐的过程,因此获取源代码是这里的最佳选择。

Note:You can rename the .jarfile to a .zipfile and can open it using any compression tool such as winraror winzipto see the content.

注意:您可以将.jar文件重命名为文件,.zip并且可以使用任何压缩工具打开它,例如winrarwinzip查看内容。