How To Get Source Code (JAVA & XML) From An Android APK File


Author: Techies Net - Technology Blog
125349 View
8m 39s Lenght
406 Rating


Did you ever think is it possible to edit an APK file or change the way it works? Or maybe change its design & look? No? The answer is yes, It is possible to break the code. To download the pre-requistics Visit - http://www.cyberfreewishes.com/blog/how-to-get-source-code-java-xml-from-an-android-apk-file Want to develop android App? Check out our pricing on developing android app - http://www.hostchef.in/app-development/android-app-development/


Comments

  1. Hi There,

    Everything was fine and according to the steps. However, on the final step I got smali folder under the application folder and was unable to locate AndroidManifest.xml file in the folder.

    Could you please let me know where and what mistake i did during the process? Could you please look into this?

    I look forward to hearing from you.
  2. Hi there, thanks for the great video!
    I have one issue, when I extract xml files it does not give me xml only smali?? how can I convert them to XML !
    thanks again!
  3. its shows some error in xml extraction
  4. C:\Users\ME\Desktop\New folder\Xml>apktool d r.apk
    I: Baksmaling...
    I: Loading resource table...
    I: Loaded.
    I: Decoding AndroidManifest.xml with resources...
    I: Loading resource table from file: C:\Users\ME\apktool\framework\1.apk
    I: Loaded.
    I: Regular manifest package...
    I: Decoding file-resources...
    W: Could not decode attr value, using undecoded value instead: ns=android, name=
    state_activated, value=0xffffffff
    W: Could not decode attr value, using undecoded value instead: ns=android, name=
    splitMotionEvents, value=0x00000000
    W: Could not decode attr value, using undecoded value instead: ns=android, name=
    state_activated, value=0xffffffff
    W: Could not decode attr value, using undecoded value instead: ns=android, name=
    splitMotionEvents, value=0x00000000
    W: Could not decode attr value, using undecoded value instead: ns=android, name=
    state_activated, value=0xffffffff
    W: Could not decode attr value, using undecoded value instead: ns=android, name=
    splitMotionEvents, value=0x00000000
    W: Could not decode attr value, using undecoded value instead: ns=android, name=
    textAllCaps, value=0xffffffff
    W: Could not decode attr value, using undecoded value instead: ns=android, name=
    splitMotionEvents, value=0x00000000
    W: Could not decode attr value, using undecoded value instead: ns=android, name=
    dividerPadding, value=0x00000c01
    W: Could not decode attr value, using undecoded value instead: ns=android, name=
    state_activated, value=0xffffffff
    I: Decoding values / XMLs...
    Exception in thread "main" brut.androlib.err.UndefinedResObject: resource spec:
    0x01010329
    at brut.androlib.res.data.ResPackage.getResSpec(ResPackage.java:61)
    at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:58)
    at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:54)
    at brut.androlib.res.data.value.ResReferenceValue.getReferent(ResReferen
    ceValue.java:62)
    at brut.androlib.res.data.value.ResStyleValue.serializeToResValuesXml(Re
    sStyleValue.java:51)
    at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResour
    ces.java:440)
    at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:243
    )
    at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:115)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:114)
    at brut.apktool.Main.cmdDecode(Main.java:146)
    at brut.apktool.Main.main(Main.java:77)







    i got this error
  5. Hello my friend, I tried again and again but it didn't work with me can you help me extract the source code of the application need.
  6. plz when i extract i don""t have fichier .dex
  7. how i can you that file Decompiled on Android Studio or Eclipse ?
    because i try and i find some error.
  8. can you combine the java source code and xml file and run it in studio because after extraction there is no R.java File which is Auto Genereted Can you suggest me how i get it
  9. i got a problem
    ==>>
    " C:\Users\PANDEY\Desktop\xml>apktool d d.apk
    I: Baksmaling...
    I: Loading resource table...
    Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:56)
    at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:491)
    at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:74)
    at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:66)
    at brut.androlib.Androlib.getResTable(Androlib.java:50)
    at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:189)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:114)
    at brut.apktool.Main.cmdDecode(Main.java:146)
    at brut.apktool.Main.main(Main.java:77)

    Caused by: java.io.IOException: Expected: 0x001c0001, got: 0x00000000
    at brut.util.ExtDataInput.skipCheckInt(ExtDataInput.java:48)
    at brut.androlib.res.decoder.StringBlock.read(StringBlock.java:44)
    at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:102)
    at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:83)
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
    ... 8 more
    ".

    Please any one help me.......
  10. how to get apening text on apk
  11. After loading the resource table in the command prompt the code is showing as following,


    I: Loading resource table...
    Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:56)
    at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:491)
    at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:74)
    at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:66)
    at brut.androlib.Androlib.getResTable(Androlib.java:50)
    at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:189)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:114)
    at brut.apktool.Main.cmdDecode(Main.java:146)
    at brut.apktool.Main.main(Main.java:77)
    Caused by: java.io.IOException: Expected: 0x001c0001, got: 0x00000000
    at brut.util.ExtDataInput.skipCheckInt(ExtDataInput.java:48)
    at brut.androlib.res.decoder.StringBlock.read(StringBlock.java:44)
    at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:102)
    at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:83)
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
    ... 8 more

    And finally only the "smali" folder is available in the xml "T" folder
  12. im getting error while getting XML files .. Please help. Following is the error

    I: Baksmaling...
    I: Loading resource table...
    Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:56)
    at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:491)
    at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:74)
    at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:66)
    at brut.androlib.Androlib.getResTable(Androlib.java:50)
    at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:189)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:114)
    at brut.apktool.Main.cmdDecode(Main.java:146)
    at brut.apktool.Main.main(Main.java:77)
    Caused by: java.io.IOException: Expected: 0x001c0001, got: 0x00000000
    at brut.util.ExtDataInput.skipCheckInt(ExtDataInput.java:48)
    at brut.androlib.res.decoder.StringBlock.read(StringBlock.java:44)
    at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:102)
    at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:83)
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
    ... 8 more
  13. will this also work for closed source apps such as instagram or facebook etc??
  14. very helpful indeed!!
  15. Thanks for your video ! :)
  16. Hi , Can anyone help on below error while executing class jar file.
    C:\Users\Mani\Desktop\My Project\Tools\dex2jar-2.0>dex2jar classes.dex
    'dex2jar' is not recognized as an internal or external command,
    operable program or batch file.

    Thanks in advance.
  17. funny how windows seems old to me now.
  18. i liked it.Thanku .
  19. you will see the code but you cant run it on android studio..
    some of the codes are automatically change and the ID of the specific type was change into a number.
  20. 'java' is not recognized as an internal or external command,
    operable program or batch file. !!!!