Wednesday 17 December 2014

Implement Arxan GaurdIt protection for Android application having library project

If you are stuck with Arxan protection for an Android application having library project please see few steps below

1. Edit Gaurdspec.gsml like ..

<target>        <pair>            <input>bin/classes</input>            <output>bin/guardit4j/protectedclasses</output>        </pair>        <pair>            <input>../library/bin/classes.jar</input>            <output>bin/guardit4j/protectedlibs/classes.jar</output>        </pair></target>

Add pairs for all the library project along with all the jars from lib folder. If you have 3 library project and each of them are using another 3rdparty jars resides in the respective libs folder add that as a pair also.

2. Add the lines below in gaurd4jrules.xml to marge all the library project into a single obfuscated.jar

<!-- Merge the protected app, the protected Container and any other library jars into 1 file -->   <jar destfile="${guardit4j.dir}/obfuscated.jar">      <fileset dir="${guardit4j.protected.dir}"/>      <zipfileset includes="**/*" src="${guardit4j.dir}/protectedlibs/classes.jar"/>
  </jar>   <!-- Clear list of library jars to be converted to Dalvik - all code must be in obfuscated.jar -->        <path id="out.dex.jar.input.ref"/>

3. If you are using Gson library then modify gaurd4j.bat and append "-DKeepSignatures" with the java command.

For further help please fill free to contact me.


1 comment:

  1. hi, we are using multiple build types and flavors,
    could you kindly provide some snippet sample in the guardit4j block in gradle file ?
    we tried name the variant name like "Flavor1Type1", it failed .. :(

    it's like http://i.imgur.com/UGI4iQr.png

    ReplyDelete