开发者

Can obfuscation (proguard) lead to MIDlet malfunction?

Im trying to obfuscate a Java MIDlet with proguard. It runs ok on the PC, however, when I run it on the phone, the program opens, connects to the server, and then freezes. If I disable obfuscation, it runs ok again on the phone. Ive tryed all the obfuscation levels for apps (7, 8 and 9 at NetBeans), and none of them seems to work properly, and I cant release this app for comercial use without obfuscation. Also, the compiler throws some warnings:

Note: duplicate definition of library class [java.io.ByteArrayOutputStream]
Note: there were 14 duplicate class definitions.

But I dont know if this is realy the problem. Does anyone knows what is wrong开发者_开发问答? The obfuscator arguments are listed below:

Obfuscator Arguments (7):
    -dontusemixedcaseclassnames
    -default package ''
    -keep public class ** {
        public *;
    }

Obfuscator Arguments (8): same as (7) plus -overloadaggressively.

Obfuscator Arguments (9): same as (8) but
    -keep public class ** extends javax.microedition.midlet.MIDlet {
        public *;
    }
instead.

Thanks.


Obfuscation can break stuff. Without potted example code it's hard to say exactly what might be wrong. An example of something that could go wrong is if you load a class in your code by name - the obfuscated class will have a different name, and hence will not be found.

The messages you mention could be indicative of the problem - you must have those classes more than once on your path. Is that class you mention pertinent to the connection you're having problems with? Look closely at the jars in use and ensure the the right (and minimum) set of classes are being included in your application. ByteArrayOutputStream in the CLDC is not the same as in the desktop JDK.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜