How to create an obfuscated jar file?

后端 未结 5 955
故里飘歌
故里飘歌 2021-02-02 03:23

How can I go about creating an obfuscate jar file? As of now I can easily export my Android lib project to a jar and use it. How do I obfuscate the jar file?

My end goa

5条回答
  •  [愿得一人]
    2021-02-02 03:27

    To create an obfuscated jar file you can do that by adding build.xml file to it and making changes in your proguard-project.txt file and running ant release from command line and you will find the obfuscated.jar under a proguard folder in your bin folder of project

    Steps

    • To add build.xml in your project in linux:

      open a terminal and go to android/tools/ant folder and run

      ./android update project -p /path_of_your_android_library_project 
      

      and you will find build.xml in your project root directory.

    • to enable obfuscation in your project:

      In your editor open a project.properties file and remove comment from

      proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
      
    • add your changes to proguard-project.txt file and in terminal go to your project and run

      ant release 
      

提交回复
热议问题