Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 中的意料之外的应用崩溃以及解决它们的方法 #7849

Merged
merged 8 commits into from
Feb 4, 2021
Merged

Android 中的意料之外的应用崩溃以及解决它们的方法 #7849

merged 8 commits into from
Feb 4, 2021

Conversation

PassionPenguin
Copy link
Contributor

@PassionPenguin PassionPenguin commented Jan 9, 2021

译文翻译完成,resolve #7161 @lsvih

@PassionPenguin PassionPenguin changed the title Translation/unexpected app crashes on android and how to deal with them Android 中的意料之外的应用崩溃以及解决它们的方法 Jan 9, 2021
@ghost
Copy link

ghost commented Feb 1, 2021

@lsvih 校对认领

@lsvih
Copy link
Member

lsvih commented Feb 1, 2021

@zenblo 好的~


Every android app runs in its own process and this process has been allocated some memory by the Operating System. When your app is put in the background while the user interacts with other applications, the OS can kill your app process if there’s not enough memory available for your application. This generally occurs when another app is being run in the foreground which demands greater phone memory (RAM).
当应用程序进程终止时,所有数据对象和临时数据会丢失。而当您返回到应用程序时,系统将创建一个新的进程,并且您的应用程序将从堆栈顶部的 Activity 中恢复。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

并且您的应用程序将从堆栈顶部的 Activity 中恢复。
=>并且您的应用程序将从堆栈顶部的活动(activity )中恢复。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Activity算专有名词了,安卓开发不知道真的不太好意思了这个


When the user navigates back to the app from the background, if the app process was killed, the app would restart from the SplashActivity as if it is a fresh app launch.
当用户从后台导航回被结束了的应用程序时候,该应用程序将从 SplashActivity 重新启动,就好像它是一个全新的应用程序启动一样。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

就好像它是一个全新的应用程序启动一样
=>就好像是启动一个全新的应用程序一样

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是全新的...吧,应用程序又木有重装(

这个翻译很难搞,我改成了 [就好像它是应用程序一次新的启动一样]


By now, you must have noticed that you can save and access data from ‘Bundle’ objects. Save all the necessary information in each Activity/Fragment similar to how we have done in the previous example.
现在,您必须已经注意到可以保存和访问打包的数据。与前面的示例类似,将所有必要的信息保存在每个 Activity / Fragment 中。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

将所有必要的信息保存在每个活动或片段(Activity/Fragment)中

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上,并且也不应该翻译为片段吧(


Since we are accessing data that was saved in a bundle, the app crash should be prevented and the app should resume from where it was left off. All the other Activities/Fragments would also be recreated.
由于我们会访问保存在打包的数据,这会防止应用程序读取遗失的数据,从而防止应用崩溃崩溃。并且该应用程序会从被终止处恢复。所有其他 Activity / Fragment 也将重新创建。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

所有其他 Activity / Fragment 也将重新创建
=>所有其它活动或片段(Activity/Fragment)也将重新创建

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上


App Crashes due to process-kill are very common on the Android platform. With newer Android versions, it is observed that background apps are killed aggressively to save on phone battery.
Android 平台上,由于进程终止导致的应用崩溃是很常见的。而如果我们使用较新的 Android 版本,我们可以观察到后台应用程序被大量结束以节省手机电池。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我们可以观察到后台应用程序被大量结束以节省手机电池
=>我们可以发现后台应用程序被大量结束运行以节省手机电源

@ghost
Copy link

ghost commented Feb 2, 2021

@PassionPenguin @lsvih 文章很棒,提了一点小建议

Co-authored-by: HumanBeing <[email protected]>
@PassionPenguin
Copy link
Contributor Author

assign proofreading to @HumanBeingXenon

Co-authored-by: zenblo <[email protected]>
@PassionPenguin
Copy link
Contributor Author

已修正 @zenblo :)

@HumanBeingXenon
Copy link
Contributor

@lsvih 校对认领

@lsvih
Copy link
Member

lsvih commented Feb 3, 2021

@HumanBeingXenon 欢迎校对

@lsvih lsvih removed the 校对认领 label Feb 3, 2021

This is a problem and before we move on to the solution, let us replicate this scenario.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

添加“这是个问题。在我们继续讨论解决方案之前,让我们复现一下这种情况。”

Co-authored-by: HumanBeing <[email protected]>

Co-authored-by: HumanBeingXenon <[email protected]>
@PassionPenguin
Copy link
Contributor Author

@lsvih @HumanBeingXenon 校对完成啦 🍻

@@ -2,80 +2,77 @@
> * 原文作者:[Kunal Chaubal](https://medium.com/@kunalchaubal)
> * 译文出自:[掘金翻译计划](https://github.com/xitu/gold-miner)
> * 本文永久链接:[https://github.com/xitu/gold-miner/blob/master/article/2020/unexpected-app-crashes-on-android-and-how-to-deal-with-them.md](https://github.com/xitu/gold-miner/blob/master/article/2020/unexpected-app-crashes-on-android-and-how-to-deal-with-them.md)
> * 译者:
> * 译者:苏苏的 [PassionPenguin](https://github.com/PassionPenguin/)
> * 校对者:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

添加校对者信息

@lsvih
Copy link
Member

lsvih commented Feb 4, 2021

还有统一一下“你”和“您”

@PassionPenguin
Copy link
Contributor Author

@lsvih 修好啦~

@lsvih lsvih merged commit 041b17b into xitu:master Feb 4, 2021
@lsvih
Copy link
Member

lsvih commented Feb 4, 2021

@PassionPenguin 已经 merge 啦~ 快快麻溜发布到掘金然后给我发下链接,方便及时添加积分哟。

掘金翻译计划有自己的知乎专栏,你也可以投稿哈,推荐使用一个好用的插件
专栏地址:https://zhuanlan.zhihu.com/juejinfanyi

@PassionPenguin PassionPenguin deleted the translation/unexpected-app-crashes-on-android-and-how-to-deal-with-them branch February 4, 2021 08:58
@PassionPenguin
Copy link
Contributor Author

PassionPenguin commented Mar 10, 2021

本文已获得原作者转载、修改的权限,转载请注明原作者以及原文链接

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android 中的意料之外的应用崩溃以及解决它们的方法
3 participants