开发者

Signed android app behaves different from when run manually on device from Eclipse?

I'm feeling screwed up now after working on this problem for the last century. Thanks in advance for your help!

What Happened: I develop an app, which is a game that contains a game activity that uses CountDownTimers for timed game rounds. Pausing, exiting the app from this activity 开发者_开发百科(via pressing the power button, home button etc.) works fine when tested on my Samsung Galaxy Tab 7", running the unsigned app from Eclipse before it has been signed.

Ecstatic that I've completed my work, I go ahead and sign the freaking apk in CMD. I test the signed app just to check that it works fine by copy+pasting the signed .apk into the SD card of the same Galaxy Tab and then installing it after removing all the old data of the app run from Eclipse but OF COURSE IT DOESN'T WORK.

Things going wrong include the activity not pausing when I press the power button when the timed round is being run (after I power the device back on I discover that the timer has been running while the screen was powered off and is still running, and my pause game dialog is nowhere to be found), the activity being closed when I press the home key (after I press the home key and open the app again the app restarts from the introductory splash screen of the app) and lastly, when I pause the game midway, power off and on the screen, hit resume on the pause game dialog - the game timer goes from something like 18.42s straight to 0.00s and continues from there into the next activity.

Okay, so that is very much more of a story than a question about code - but here's the technical question - why is my signed app behaving differently from the unsigned one that was run from Eclipse? I'm not providing any code here of how i did those things, since that should be irrelevant considering that they work in the first place (as in by running the app on my device while developing in Eclipse).

So very nearly there... URGH


Not sure if this is actually your problem ... but the most common reason that a signed app does not work when the unsigned/Eclipse version does is that building the signed app generally includes a Proguard obfuscation/optimization step.

One of the consequences of Proguard optimization is that some of the classes/methods referenced in either your XML layouts or using reflection may no longer have the same name (or may have been optimized out altogether).

The easiest/fastest way to check is to look at the logcat trace - there'll be a ClassNotFoundException or MethodNotFoundException or somesuch.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜