[SOLVED] Proguard Obfuscating (default)

Hi,
I am trying to make the default obfuscating to work with no success.
It compiles and generates all jars, but when I run it I got erros like :

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.AbstractMethodError: com.jme3.app.SimpleApplication.simpleInitApp()V
        at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
        at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
        at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
        at java.lang.Thread.run(Thread.java:745)

This is my obfuscate-impl.xml ( preaty much the default one with the fix on the bug path ) :

<?xml version="1.0" encoding="UTF-8"?>
<!--obfuscate-impl.xml v0.11-->
<project name="obfuscate-impl" basedir="..">
    <target name="-obfuscate" depends="-test-obfuscate-enabled,-create-library-property" if="is.obfuscate.enabled">
        <taskdef resource="proguard/ant/task.properties"
         classpath="${libs.pro-guard.classpath}" />
        <proguard>
            -libraryjars ${proguard.library.path}
            -injars      ${dist.dir}/lib(!META-INF/MANIFEST.MF)
            -injars      ${dist.jar}
            -outjars     ${dist.jar}.obfuscated.jar
            -keepclasseswithmembers public class * {
                public static void main(java.lang.String[]);
            }
            ${obfuscate.options}
        </proguard>
        <delete file="${dist.jar}"/>
        <move file="${dist.jar}.obfuscated.jar" tofile="${dist.jar}"/>
        <delete>
            <fileset dir="${dist.dir}/lib" includes="**/*.jar"/>
        </delete>
    </target>

    <target name="-test-obfuscate-enabled">
        <condition property="is.obfuscate.enabled">
            <istrue value="${obfuscate}"/>
        </condition>
    </target>

    <target name="-create-library-property" depends="-create-mac-library-property">
        <property name="proguard.library.path" value="${java.home}/lib/rt.jar"/>
    </target>

    <target name="-create-mac-library-property" depends="-test-mac" if="is.macos">
        <property name="proguard.library.path" value="/System/Library/Frameworks/JavaVM.framework/Classes/classes.jar"/>
    </target>

    <target name="-test-mac">
        <condition property="is.macos">
            <os family="mac"/>
        </condition>
    </target>

</project>

I am preaty sure its something easy to fix like just to add a line in the obfuscate-impl.xml but I culd not fix it yet.
There is anyone that made this work already ?

I made this to work so time a go, forgot to put solved on this topic.
I used the new proguard version thought, it seens to be easy to configurate.

Yesterday I was reading an article about obfuscating in java and today I saw a post regarding this.(what a good incidence :grinning: ) here is the address : http://www.excelsior-usa.com/articles/java-obfuscators.html
It is really good and easy to understand.
tow free obfuscation tools : Proguard (open source) and yGuard
I am glad to hear we can use them in JME.
but I have 2 question .
1- Does it highly impact in game performance if we use obfuscation tools?
2- Can we use for android ?

thanks.

Hi Ali !
Yes, for my surprise its working fine with Jm3, there was some work to refine the obfuscation “ignores” since my project was a little big, but its working fine now.
About your questions :

  1. I felt the app runs faster when obfuscated, even not using the performance boost from the proguard. Also the result jar gets a bit smaller.
  2. As far as I understand, you dont need obfuscation for android, its obfuscated already when you compile on Jm3.
1 Like

I kind of wish Minecraft had obfuscated their code. No modding community == almost no success == much easier to compete. :wink:

I haven’t looked at minecraft in a long time. But back in “the day”, it was obfuscated, and the community figured out what certain classes were doing and created a program to de-obfuscate it in a way that didn’t reveal what the original code was exactly (obviously thats impossible). A lot of method and variables still weren’t named properly and left as “variable_0049” or something like that.

The decision to obfuscate and/or encrypt code and assets depends from game to game…
I think in an minecraft like game you dont need to worry much about the code and assets ( there is not even assets in this game)…

lol. Yeah, it’s just one giant flat gray plane…

I guess… but it doesn’t really change the fact that it was pirated plenty and still succeeded.

People who somehow play your game without paying are not lost customers. They are noise.

2 Likes