-1

I've downloaded such an open source android project from github repo. , and the classes which I want to edit are under build/intermediates/exploadded-aar/ly.img.android/photo-editor-sdk/2.0.13/jars , then there is classes.jar folder , inside this I have more folders one child contains classes , I want to edit in file called "ImgLyConfig.class" , when I unzip .jar file and go to that class I found it like this enter image description here , what I do is go to online decompiler http://www.javadecompilers.com/ , then I have a decompiled class I downloaded it , and edit whatever I want , then I want to replace ImgLyConfig.class file which is in the .jar file with my new edited one , I tried this soultion How do you recompile a jar file? , and other many solutions in Google and in Stackoverflow , but still my classes didn't edited , also I tried to create such a new class and copy the code of the class I want , but I didn't know how to make code use the new class not the old one , also I've tried to extends it and change in it but I've failed also :/

NP : my class in android studio looks like this : enter image description here and it doesn't accepting any editing

, my android studio is 2.1.2 and library which I want to edit in github is https://github.com/imgly/imgly-sdk-android-demo ,

Community
  • 1
  • 1
  • you just download that project then after extract in you pc in any folder then after import as a modual so you can easily edit it – Farmer Nov 05 '16 at 11:56
  • - Thanks for fast response - But , How can I import it as a module , Could you please give me such steps to do that ? – Karim Abd Elhameed Mohamed Nov 05 '16 at 11:59
  • The img.ly library license does not allow you to modify it. You can get in legal trouble when you publish an app with such a library. – zapl Nov 05 '16 at 12:00
  • Even I will do that for such a practice ? @zapl – Karim Abd Elhameed Mohamed Nov 05 '16 at 12:07
  • @zapl , Excuse me , but according to github repo they have an option in documentation called " **Customize SDK config for your own Android App**." Which Exactly what I want !! , So how do u say that I can't edit its tools – Karim Abd Elhameed Mohamed Nov 05 '16 at 12:29
  • By putting code like in their [example](https://github.com/imgly/imgly-sdk-android-demo#4-customize-sdk-config-for-your-own-android-app) into your source, yes. Modifying their code is something entirely different. – zapl Nov 05 '16 at 12:36

1 Answers1

1

If you're changing code then you need to recompile the source code to get the updated jar. If the project is open source there should be instructions on the github repo on how to compile it using maven/gradle etc.

What you should do is:

  1. Download the source code from the github repo, not the compiled jar files.
  2. This will give you the editable .java source code files, not the compiled byte code .class files. You can easily edit the .java files without having to decompile them first
  3. Compile the jar from the source code.

Human readable java source files are compiled into machine readable byte code by the JDK and stored in .class files. Class files are then packaged together in .jar files.

When you decompile a .class you get close enough to the .java file but some things will not be fully the same after the compilation and decompilation.

Tom Hanley
  • 1,252
  • 11
  • 21
  • 2
    Thank u very much , You add new info. to me (Which I really appreciate ) , I recognize where is my fault , Simply , It's not related to compile/decompile , It's related to how important should I read whole Documentation for something I use . :) – Karim Abd Elhameed Mohamed Nov 05 '16 at 12:42