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.
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.
Related
A couple of days ago, I was copying and pasting my code into a new class. While the entire code was selected, I hit the backspace key. The entire code deleted, and I did not realize. My computer then died. Today, I opened it back up, and none of the code was there. The only thing that remained was an empty file. Is there anything I can do?
The two comments cover most of it. There are only 3 places your code could possibly be. If you checked them all and none of them have it, you're out of luck.
Eclipse Local History
Right click the file in the package explorer and pick the 'Restore from local history...' option. Hurry up, eclipse auto-removes local history that's older than 7 days!
VCS
If you're using version control and you checked this in before, it's a simple restore away. For example, git checkout path/to/the/file.java would do it. You'd have to explain which VCS system you are using and how are you accessing it (via eclipse teams, via e.g. Fork.app, via the command line, etc).
Backups
You're using a computer. It should have backups. These backups need to run automatically and preferably be going 'off site' (to a place that you do not live, you don't want a fire or some serious burglary to mean you have lost both your system and your backup!). If you don't have that, you're, uh, well, I don't want to insult you, so you should find some suitable insult that describes a very silly person and then yell that at a mirror.
The only excuse to not have backups for a system is if the system does everything in the cloud. Chromebooks really don't need it for example. If you're programming, unless it's some fancy cloud-based programming layout, this does not apply to you, and therefore you should be finding a mirror right about now if you don't have a backup solution in place.
There are open source tools like arq where you fully control where the data goes. Various NAS (Network-Attached-Storage) systems have the option to sync with another NAS elsewhere over the network, so buy one for yourself and for a friend, and be each other's backup buddy. Or just toss some money at it; services like Backblaze offer fixed fee backups and offer client side encryption if that's a worry for you.
I originally posted this question on GameDev stackexchange however I'll also ask the question here to try and get more outreach, especially since I wasn't sure my problem was specific to game development since it's a problem with a Java native call.
For the past months I've been working on creating my own game engine for personal use in LWJGL using pieces here and there, especially from developer ThinMatrix's rightfully credited code, to learn as much as I can while building it. Only recently there has been strange behavior happening when I launch the engine from IntelliJ for testing:
After about 6-10 individual times I click run, all subsequent runs suddenly take about 60 seconds for the window to appear.
Whenever I restart my PC this hanging resets and I have another 6-10 runs before it hangs everytime again.
I located the issue to glfwInit, more specifically at the call to the native method:
#NativeType("int")
public static boolean glfwInit() {
long __functionAddress = Functions.Init;
return invokeI(__functionAddress) != 0; // Right here
}
I also noticed that this issue only started when I attempted to implement text support in my engine using the STBTrueType library. It was perfectly fine before that. I tried removing the TrueType code but it didn't fix it.
Here's a list of things I've tried:
Clearing my temp folder in case a buggy or corrupted file was present.
Recompiling and rebuilding the entire LWJGL jars twice.
Building glfw.dll from the GLFW sources and replacing the glfw.dll in the native jars with the former.
Reinstalling Java and actually upgrading JDK versions (from 13.0.2 to 14.0.2)
Switching IDEs even if I suspected it wouldn't work.
Updating my NVIDIA drivers, and reinstalling them.
I'm quite confused as to what it could be, and I'd be more than happy to share code, thread dumps, or debug info if you deem it necessary. Here is the Github repository with the latest, "faulty" code (fault in quotes because I'm not too sure the code is the problem.)
Thank you very much for any guidance.
P.S: Please tell me if this is better asked in StackOverflow instead of here.
So I fixed the issue, it turns out it wasn't even related to anything to do with programming, or STBTrueType, or the library itself. The problem was as pointed out in this StackOverflow post, where this hanging behavior was due to a faulty driver or, in my case, my keyboard USB being plugged in the "wrong" USB port. I moved my computer at the same time I started working on text in my engine, hence why I wrongly linked the issue with the TrueType library. If you're having the same issue, look at the aforementioned post or if that doesn't work, look for a peripheral that might cause interference.
I ask this question because I couldn't find the answer I was looking for but simply put is there anything in place in the app store to prevent stolen code? I notice that there are a lot of clones on android which made me wonder whether they are directly ripped off or just so easy to replicate that they end up cloned.
Can people just simply download the apk file and reverse engineer it?
Is there anything google has in place that prevents this, or if there isn't, is there anyway that I myself can prevent it or make it more difficult for people wanting to steal my code?
I'm still new to Java and learning so it will be a while before I start this, but the project I have in mind will consume a large chunk of what little spare time that I have for a while, so I don't want to put a lot of time into it without proper measures only to have it stolen and sold for someone else's profit in a week.
If this has been answered before whether on this site or another please point me to there and delete this if necessary.
Well, you can do code obfuscation, so that on de-compiling the code, the logic is not obvious, so hard to maintain.
You can use the free version i.e. ProGuard or much powerful professional version DexGuard.
Here is an example which shows how to configure ProGuard when you are using libraries.
Retrofit+ProGuard.
I had some software developed on oDesk about a year ago. What I get back is a java based .EXE
It runs as a standalone without any sort of installation. The problem is they screwed up some graphics for the buttons, it didn't bother me at the time, because I got what I wanted, a minimal viable product that got the job done.
With that said, it's been bothering me for a while, and when I reach back out to the guy - I can't get him.
I used 7zip to open the .EXE and extracted all the contents. I found where the buttons were and fixed them, obviously trying to drag it into 7Zip in the specified location isn't going to work.
How do I go about recompiling everything?
I'm new to all this, so if you need any additional information, please don't hesitate to ask. I just want this thing to look as I intended.
I tried to reimport my android project on eclipse to solve a problem but I accidently overwrote all my files in the project. All of them had been corrupted which means their size is now 0B...
I tried to use Local History but it's useless since my project is no longer in my workspace, same for .metadata.
I also tried to use Recuva (Software for recovering files) which see my files with their real size but when I try recover them, their size is always 0B...
I lost about 7 days of work and I don't really want to rewrite my code using Java Decompiler...
So my question is, is there any solution to recover that files ?
I wrote 200 lines of code and suddenly system restarted. I lost all code. But I recovered data from eclipse's local history. Right click on the file -->replace with-->previous from Local History
Eclipse has a local history, although by default it's set very low - one of my first tasks when setting up a new development machine is to up the values (in addition to my other version control)
If you do have a history you can right click on your class, and select compare with local history.
You could try decompiling with something like JD-GUI. It might not be as onerous as you think. Obfuscators exist for a reason.
It is not really programming question, but i had similar situation and "Mini Tool Power Data Recovery" tool helped me (it is paid tool, free version exists, but maybe you can search in this direction and find something open source). I tried some another tools then, but with no results.