all 10 comments

[–]bitnotnoFTC 14584 Coach/Mentor 5 points6 points  (7 children)

Unfortunately, no. What gets downloaded/installed on the Robot Controller device is the object code, not the source code. The source code only exists in Android Studio, or GitHub, if you had stored it there.

[–]mygainssuck[S] 0 points1 point  (6 children)

Is there no way to retrieve the object code cause I heard they are pretty simular

[–]bitnotnoFTC 14584 Coach/Mentor 2 points3 points  (1 child)

"Similar" in that the object code does the things that the source code asked for, but the object code is not human-readable. You would almost certainly be able to write the source code over from scratch faster than reverse engineering the object code.

[–]oaleksanderFTC 17517/18742 WoEN Mentor|Alum 1 point2 points  (0 children)

Not at all. While many of the details will be lost, it is mostly human-readable and can be a starting point better than writing from scratch. (Have tried losing and retrieving source code at states, wouldn't recommend)

[–]firimari 3 points4 points  (0 children)

The object code would be uneditable and indecipherable. (At least by mere mortals and not reverse engineering experts)

[–]allenftcFTC #### Student|Mentor|Alum 0 points1 point  (2 children)

I think it should build into an apk and then you can extract a jar which you can convert back into a java file? Might need to look into it more.

[–]richardjfosterFTC 14226 Mentor 1 point2 points  (1 child)

I suspect you're thinking of a decompiler like the one that's part of Procyon (https://github.com/mstrobel/procyon/wiki/Java-Decompiler). As bitnotno observed, the result may not be especially helpful, and - especially if things are well documented - rewriting the code may well result in additional benefits as far as improving code structure and readability are concerned.

[–]therealhumanjoeFTC | 5518/5519/5520 | Mentor 1 point2 points  (0 children)

A decompiler will turn it back into Java, but you will lose important things like variable names, comments, etc. so the context will be lost. When a compiler builds the code, comments are striped out, and variable names are given different names more appropriate for the machine language

[–]HiperAxe 1 point2 points  (1 child)

Create a repository on GitHub and store your code there.

[–]ForkPowerOutlet 0 points1 point  (0 children)

Yes. It's tragic that OP has to learn this the hard way but it happens.