Is it possible to compile a .java file without having the necessary dependencies (the compiler swears by default)? And .smali?

Theoretically, it is quite possible. The .class file still does not know anything about the classes, methods, etc., on which it depends, it simply refers to them. We can create an html page with hyperlinks leading in 404, and the IDE will not prevent us from saving it, and browsers will render it, and problems will only occur if you try to follow the link. And no one thinks it is illogical.

All this is needed in order to quickly correct the code of the decompiled / disassembled application, "save" back, and test. Without wasting too much time with other modules - and disassembling them from class to smali.

  • one
    I think your question can be published as an answer) - Android Android
  • one
    Theoretically, it is quite possible. I think no need to explain why. (c) - Vladyslav Matviienko
  • ... or is it still needed? Judging by the strange reaction to the question. As if I ask "is it possible to remove the standard window About the program from Windows, where the copyright is Microsoft." Well, I will explain. The .class file still does not know anything about the classes, methods, etc., on which it depends, it simply refers to them. We can create an html page with hyperlinks leading in 404, and the IDE will not prevent us from saving it, and browsers will render it, and problems will only occur if you try to follow the link. And no one thinks it is illogical. And here - on you. - Simus
  • 2
    It is for this attitude that “there is no need to explain why” you are minus. Because it is necessary only in very exotic cases, and for your problem to be solved there may be a much simpler solution. There is a well-known XY-problem: when the question is not about the problem, but about an erroneous attempt to solve the problem. Explain why you want to do this. - D-side
  • 2
    your question is minus just because it is of poor quality. Do not invent for yourself nonsense like spring aggravation. The desire to help simply disappears when you see such a question. If you want to be helped, try to write a little more than 1 line of 8 words. And for some reason, you take the cons to your question on a personal account. - Vladyslav Matviienko

1 answer 1

If you do not check the dependencies during compilation, the signature of the method being called will not be known, up to the types of parameters and the return value.

And since the signature of the method being called is written to the pool of class constants , it will not be possible to generate a final .class file.

  • Hmm ... What about the compilation is not java, but smali? It would seem that, having received .smali from .class, we received all the information that was in it. Logically, it should be enough to get the class again. - Simus
  • In appearance is enough. What prevents to try? - Nofate
  • Why do they ask questions? After all, you can just try. - Simus
  • 3
    Questions are usually asked when tried, and something did not work. - Nofate
  • four
    In these three hours of fighting, you could download backsmali and smali, parse and assemble some .dex and contribute to the community by publishing the answer to your question. Once again: www.stackoverflow.com/help/how-to-ask - Nofate