F
F
falstaf2011-09-05 10:31:06
Java
falstaf, 2011-09-05 10:31:06

Android, SimpleXML, ProGuard?

There is a project that uses the SimpleXML library ( simple.sourceforge.net ) to parse XML , which uses Java annotations to mark up the class schema.
It was necessary to obfuscate the project using ProGuard , after obfuscation everything works successfully, except for the XML parsing classes. A NoSuchMethodException is thrown .
It is logical to assume that the problem is in ProGuard's obfuscation of annotations and their classes, however, persistent reading of ProGuard's documentation and manipulations with obfuscation options did not lead to the desired result.
If anyone has experience with a similar problem, any help would be greatly appreciated.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
megatron, 2011-09-07
@megatron

Try this:
-keep class com.simpleframework.** { *; }

M
mgarin, 2011-09-05
@mgarin

It is unlikely that I will be very useful, but I dealt with yGuard (they have fewer features and options than ProGuard, as I know) - there all such things are configured for individual packages or classes. Or globally - for example, “do not obfuscate static methods”, “do not obfuscate method names”, etc.
The settings look something like this (right in the build script):

  <target name="obfuscate">
    <taskdef name="yguard" classpath="installer/obfuscate/yguard.jar"
         classname="com.yworks.yguard.YGuardTask" />
    <yguard>
      <inoutpair in="dist/guidesigner.jar" out="dist/guidesigner-sec.jar" />
      <externalclasses>
        <path refid="obfuscate-process-path" />
      </externalclasses>
      <rename mainclass="com.alee.designer.app.Designer" logfile="dist/obfuscation.log">
        <!--<property name="error-checking" value="pedantic"/>-->
        <keep>
          <class implements="com.alee.designer.NonObfuscable" fields="private" />
          <class name="com.alee.designer.app.dialogs.pixelgrabber.PixelGrabber"
              methods="public" />
          <class name="com.alee.designer.viewer.DesignerViewer" methods="public" />
        </keep>
      </rename>
    </yguard>
  </target>

This, of course, is not all, but I think the general idea should be clear.
What is between “keep” is exactly the things excluded from obfuscation.
We cheated a little, of course - we made a separate NonObfuscable interface - everything that implements it is automatically excluded from obfuscation (at least the names of methods and variables) and eventually allows you to use classes to save data in XML.
Hope this helps you somehow.

D
dimazaur, 2012-06-09
@dimazaur

everything worked for me like this:
-libraryjars lib/simple-xml-2.6.2.jar
-libraryjars lib/httpmime-4.1.2.jar
-dontwarn javax.xml.stream.**
-keep class com.mypackages.**{ *; }
-keep class org.**{ *; }
-keepattributes *Annotation*

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question