-1

Okay, so my programming teacher sent me an app that I should look at and modify. I downloaded the APK file, and turned it into a source code following these instructions: how to extract code of apk file.

I have the java (src) files, the resources files, and the XML files. I have the Manifest file too.

I imported them successfully on eclipse, but now it has like 2000 errors.

I really don't know what to do. The apk works fine on my phone.

Why is it doing this?

If anyone needs the apk, I'll upload it.

If someone can be so generous to convert it into a working eclipse workspace for me, I'll be more than grateful.

Community
  • 1
  • 1
  • You are mostly missing some imports, try importing the necessary packages. – Ankit Rustagi Dec 24 '13 at 06:18
  • Try using "Ctrl+Shift+O" for the same. – Ankit Rustagi Dec 24 '13 at 06:19
  • 1
    yes what problm you are facing to export code from apk u need apktool,dex2jar,jdgui. without u cant get source code from apk – raj Dec 24 '13 at 06:20
  • You may also want to let us know, what kind of errors they are.. As Ankit said, they may be related to imports. Try pressing Ctrl+Shift+O in the files that you have the errors. We can't help unless you provide us details about what the errors are.. – Vamsi Challa Dec 24 '13 at 06:20
  • you cant directly import the extrected apk to eclipe as thr is no java files in project when you extrect them you get Dex files – raj Dec 24 '13 at 06:22
  • @raj I did all the exporting properly, with the repspective tools you just said. – user3131565 Dec 24 '13 at 08:03
  • @VamsiChalla It's all different. Some are blahblah cannot be resolved to a type, some are type mismatch errors, and some are unreachable code errors. – user3131565 Dec 24 '13 at 08:05
  • @AnkitRustagi Do I need more than the src, asset, res, and the manifest.xml file? I went over the src folder to see if there were any deformed files by jdgui, but that wasn't the issue either. I'm affirmative that Eclipse imported them fine. – user3131565 Dec 24 '13 at 08:08

2 Answers2

1

You can never get the exact source code from the .apk file. The .apk file is generated from the compiled classes which doesnt have all information like actual variable names, actual method names. so you cannot retrieve back 100% original source code. Basically everything will be obfuscated. so when obfuscated, multiple classes may have same name. eg: two classes may have name 'a'. Hence the Errors in Eclipse.

Shawn
  • 31
  • 7
0

As far I know re-compiling apk file will not give you exact results except the images and xml resources. Some free tools available that cannot provide 100% accurate code. here's a tutorial you can check How To Retrieve The Source Code From A Compiled Android .Apk

androidcodehunter
  • 21,567
  • 19
  • 47
  • 70