签名的 Android 应用程序的行为与从 Eclipse 在设备上手动运行时不同吗?

发布于 2024-12-09 16:54:00 字数 819 浏览 0 评论 0原文

在上个世纪研究这个问题之后,我现在感觉搞砸了。预先感谢您的帮助!

发生了什么:我开发了一个应用程序,它是一个包含游戏的游戏 使用 CountDownTimers 进行定时游戏回合的活动。暂停, 从此活动中退出应用程序(通过按电源按钮, 主页按钮等)在我的三星 Galaxy Tab 7" 上测试时工作正常, 在签名之前从 Eclipse 运行未签名的应用程序。

我欣喜若狂地完成了我的工作,我继续签署这个该死的 apk 命令。我测试签名的应用程序只是为了检查它是否正常工作 将签名的 .apk 复制并粘贴到同一 Galaxy Tab 的 SD 卡中 然后删除应用程序运行的所有旧数据后安装它 Eclipse 但当然它不起作用。

问题包括当我按下按钮时活动没有暂停 当定时回合正在运行时(在我重新打开设备电源后,我发现计时器一直在运行,而屏幕已关闭且仍在运行,并且我的暂停游戏对话框无处可寻),该活动存在 当我按主页键时关闭(在我按主页键并打开之后) 再次应用程序 应用程序从介绍性启动屏幕重新启动 应用程序),最后,当我中途暂停游戏时,关闭电源然后再打开 在屏幕上,在暂停游戏对话框中点击继续 - 游戏计时器从类似 18.42s 直接到 0.00s,并从那里继续到下一个活动。

好的,这更像是一个故事,而不是一个关于代码的问题 - 但这里有一个技术问题 - 为什么我的已签名应用程序的行为与从 Eclipse 运行的未签名应用程序不同?我在这里没有提供任何关于我如何做这些事情的代码,因为考虑到它们首先工作(例如在 Eclipse 中开发时在我的设备上运行应用程序),这应该是无关紧要的。

非常接近了...URGH

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

过度放纵 2024-12-16 16:54:00

不确定这是否确实是您的问题......但是当未签名/Eclipse 版本运行时,签名应用程序无法运行的最常见原因是构建签名应用程序通常包括 Proguard 混淆/优化步骤。

Proguard 优化的后果之一是 XML 布局中或使用反射引用的某些类/方法可能不再具有相同的名称(或者可能已被完全优化)。

最简单/最快的检查方法是查看 logcat 跟踪 - 将会出现 ClassNotFoundException 或 MethodNotFoundException 或类似的异常。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文