by Rahul Chowdhury

通过拉胡尔·乔杜里

要记住的Facepalm:我在未先测试SDK的情况下对其进行了改进。 (A Facepalm to Remember: I bumped up the version of an SDK without testing it first.)

It all started when Google made its App Shortcuts API available for developers on Android. I was super excited to add this to my hash tagging Android app, Magnify. So I started digging through their documentation for steps to implement it.

一切始于Google向Android开发人员提供其App Shortcuts API时。 我很高兴将其添加到我的哈希标记Android应用Magnify中 。 因此,我开始仔细阅读他们的文档 ,以了解实施该文档的步骤。

The first thing I noticed was the required API version for Android targetSdkVersion was higher than what I was using. “No big deal,” I thought. And I bumped it up to a newer version.

我注意到的第一件事是Android targetSdkVersion所需的API版本高于我所使用的API版本。 “没什么大不了的,”我想。 我将其升级到了新版本。

错误” (The “Mistake”)

Bumping up my SDK version wasn’t a mistake. The mistake was that I didn’t test the app extensively on the latest version of Android. I just added the shortcut feature, tested that out thoroughly, then pushed my changes — without realizing that a major API change had been made to this new version of the SDK.

提高我的SDK版本并不是一个错误。 错误是我没有在最新版本的Android上进行广泛的测试。 我只是添加了快捷方式功能,对其进行了全面测试,然后推送了更改-但没有意识到对这个新版本的SDK进行了重大的API更改。

Android Nougat enforces a check on the scope of files shared across apps in the system. If you try to share a file that is saved within the scope of your app with some external app using the traditional file:// approach, your app will hit a FileUriExposedException, causing your app to bring up that ugly crash dialog that no developer — and certainly no user — wants to ever see.

Android Nougat会强制检查系统中各个应用之间共享的文件范围。 如果您尝试使用传统的file://方法与某些外部应用程序共享保存在应用程序范围内的file:// ,则您的应用程序将遇到FileUriExposedException ,从而导致您的应用程序显示出一个丑陋的崩溃对话框,没有开发人员可以打开该对话框肯定没有用户-想要见识。

How I fixed this exception is beyond the scope of this article. Instead let me share how this one silly mistake affected my app.

我如何解决此异常超出了本文的范围。 相反,让我分享这个愚蠢的错误如何影响我的应用程序。

问题” (The “Problem”)

Before, when I targeted Android Marshmallow users, my app always managed to sneak out through that hidden door known as “compatibility mode” when running on Nougat. So I was totally chilled out knowing that my app ran fine on the latest version of the OS.

以前,当我以Android Marshmallow用户为目标时,我的应用程序在Nougat上运行时,总是设法通过被称为“兼容模式”的隐藏门偷偷溜走。 因此,当我知道我的应用程序在最新版本的操作系统上运行良好时,我感到非常激动。

android {     defaultConfig {         minSdkVersion 18         targetSdkVersion 23 //Targeting Marshmallow    }}

But now things were slightly different for my poor little app. Since it said that it was targeting the latest version of Android, the OS assumed that it had been tested well for all new API updates, and should be punished for any violations. In my case, this was FileUriExposedException, as I was sharing photos using the traditional file:// approach instead of upgrading to a safe and robust solution.

但是现在对于我可怜的小应用程序来说,情况有所不同。 由于它说的是针对最新版本的Android的操作系统,因此该操作系统假定它已经针对所有新的API更新进行了良好的测试,并应就任何违规行为受到惩罚。 就我而言,这是FileUriExposedException ,因为我使用传统的file://方法共享照片,而不是升级到安全可靠的解决方案。

android {     defaultConfig {         minSdkVersion 18         targetSdkVersion 25 //Targeting Nougat 7.1    }}

The ultimate penalty? “Unfortunately, Magnify has stopped working.

终极惩罚? “很遗憾,Magnify已停止工作。

“更大的问题” (The “Bigger Problem”)

Though the crash was a serious problem itself, I had yet to discover an even bigger problem. Since Android Nougat was only available to around 0.6% Android phone users at that time — and to around 2–3% of people using my app — this was a crash that could have been hidden for weeks.

尽管坠机本身是一个严重的问题,但我还没有发现更大的问题。 由于当时只有约0.6%的Android手机用户以及大约2-3%的使用我的应用的用户可以使用Android Nougat,因此该崩溃本可以隐藏数周。

Fortunately, one of my app users had a Google Pixel running Nougat, and it was she who brought to my attention that the app was broken. I patched it up and rolled out another update with the fix to this crash, which thankfully most users were unaware of, as I was notified of the issue within a day or two.

幸运的是,我的一个应用程序用户有一个运行Nougat的Google Pixel,正是她引起了我的注意,该应用程序已损坏。 我对其进行了修补,并针对此崩溃修复了问题并发布了另一个更新,但值得庆幸的是,由于一两天内收到有关此问题的通知,大多数用户没有意识到这一点。

Phew! That was really really close.

! 那真的非常接近。

我该如何解决? (How did I solve it?)

Yeah yeah, I said that I won’t be getting deep into solving the problem, but it’s kind of hard for me to watch a fellow developer struggle on the same problem I had, knowing that I could have helped and added some happy moments to their life.

是的,我说我不会深入解决问题,但是我很难看着开发人员在我遇到的同样问题上苦苦挣扎,因为知道我本可以提供帮助并给他们增加一些快乐的时光他们的生活。

Here’s how I did it:

这是我的做法:

file:// scheme is now not allowed to be attached with Intent on targetSdkVersion 24 (Android Nougat…Android Nougat is almost be publicly released. And as an Android developer, we need to prepare ourself to adjust…inthecheesefactory.com

现在不允许将file://方案与​​Intent一起附加在targetSdkVersion 24(Android牛轧糖上。Android牛轧 糖几乎已公开发布。作为Android开发人员,我们需要做好自我调整的准备... inthecheesefactory.com

故事的道德启示 (Moral of the story)

Never ever — and I repeat never ever — roll out an update to your software without very, very extensive testing when you have bumped up the version of your SDK. Chances are there are some API changes you were unaware of — some of which might break your software for good.

当您提高SDK版本的功能时,再也不会,而且我也永远不会重复-对软件进行更新,而无需进行非常非常广泛的测试。 您可能没有意识到某些API更改,其中一些可能永久破坏了您的软件。

Make sure you ship your updates only after proper testing. A little time spent testing can save a lot of time getting back the trust of your users.

确保仅在经过适当测试后才发布更新。 花一点时间进行测试可以节省大量时间来恢复用户的信任。

Oh, and:

哦,还有:

There are no mistakes, save one: the failure to learn from a mistake. — Robert Fripp

除了一个错误,没有错误:没有从错误中学习。 —罗伯特·弗里普

Because you don’t end a dope article without a kickass quote. ? ✌️

因为您不会在没有kickass引号的情况下结束浓汤文章。 ? ✌️

If you enjoyed this story, please do recommend it to other people by hitting the ? button on this page, and follow me for more stories about programming.

如果您喜欢这个故事,请通过点击来将其推荐给其他人。 按钮,然后关注我以了解有关编程的更多故事。

翻译自: https://www.freecodecamp.org/news/a-facepalm-to-remember-i-bumped-up-the-version-of-an-sdk-without-testing-it-first-acb16da33d41/

要记住的Facepalm:我在未先测试SDK的情况下对其进行了改进。相关推荐

  1. 相册权限_苹果手机惊现漏洞?App在未获取相册权限的情况下成功读取照片

    近日,知乎上网友爆料发现苹果手机存在漏洞,一款名叫"时间规划局"的App可在未获取相册权限的情况下读取照片.专家猜测可能是App调用了苹果的私有库,绕过了系统的授权机制. 2月26 ...

  2. 在未贴brcm4330芯片的情况下,invensense的sensor失效问题分析

    在未贴brcm4330芯片的情况下,invensense的sensor失效问题分析 结论: 启动顺序问题. sensor的上层应用会在启动过程中试图打开invensense的sys文件接口. inve ...

  3. 计算机在未关机的情况下重启,系统已在未先正常关机的情况下重新启动。游戏就断电重启。...

    我现在使用的为win10,正常使用计算机并没有什么异常,都OK的,但是最近(我已经正常使用该电脑1年时间了)只要玩游戏就会自动断电重启,而且不是打开游戏就重启,而是等待游戏载入进去之后就重启(话说是从 ...

  4. id 重启event_系统已在未先正常关机的情况下重新启动 事件ID:41

    创建日期 2018/07/18 系统已在未先正常关机的情况下重新启动 事件ID:41 日志名称:          System 来源:            Microsoft-Windows-Ke ...

  5. cassss服务未启动_Mysql无法启动情况下,如何恢复数据呢?

    本文适用于,mysql无法启动,但数据文件未丢失的情况. Mysql因意外情况,导致无法启动,数据库未做备份的情况下,如何将数据迁移至其他数据库中. 原数据库地址:192.168.1.100(以下简称 ...

  6. 并发下,使用redis防止数据重复插入(数据库未对表字段设置唯一情况下)

    2019独角兽企业重金招聘Python工程师标准>>> @Controller @RequestMapping("/myTest") public class T ...

  7. 实现文件及文件批量改名的工具(包含未确定盘符的情况下)

    标题:实现文件及文件批量改名的工具 作者:慕昊睿 时间:2019年10月30日 版权:苏比文化传媒工作室 接单:+WeChat ID:18171905547 处理前: 处理后 # 以下代码为test. ...

  8. rtsp协议_如何在RTSP协议视频智能平台EasyNVR未登录的情况下调用通道直播的接口?...

    原标题:如何在RTSP协议视频智能平台EasyNVR未登录的情况下调用通道直播的接口? TSINGSEE青犀视频云边端架构全线都提供了丰富的API接口,用户可以自由调用进行二次开发.在本文之前,我们博 ...

  9. 若依框架在未登录的情况下访问swagger页面

    本文针对若依单体项目,解决若依在不登录情况下,如何直接访问swagger页面. 框架默认在未登录的情况下,是不能直接访问swagger页面的. 最近很多人在问,为什么明明在ShiroConfig里面对 ...

最新文章

  1. 矩阵计算在计算机科学中,开发者必读:计算机科学中的线性代数(附论文)
  2. 使用STC8G1K08制作调频接收模块TEA5767配置电路
  3. cpp 怎么连接mysql_C++连接mysql数据库的两种方法
  4. Windows 10 系统安装教程
  5. 机器人科迪的天空_机器人科迪的天空游戏评测:我要跳的更高
  6. maven 中 部署构件至Nexus(mvn deploy)
  7. ipfs如何查找一个文件的_如何用 1 分钟遍历一个 100TB 的文件?
  8. 程序员的春天来了,赏花去!说走就走
  9. 持续集成部署Jenkins工作笔记0017---17.整合GitHub的持续集成环境要点说明
  10. 你是没有可能把主业做得风雨飘摇,却把副业做得风生水起的
  11. 美国专家声讨物联网安全 面对攻击如纸糊
  12. java textarea 自动滚动条_月光软件站 - 编程文档 - Java - 如何实现滚动条的自动滚动到textarea的末尾...
  13. Ansys Maxwell三相变压器制作方法教程
  14. 百度文库刷财富值软件-第二版
  15. Windows 10 的快捷关机方式
  16. 第四章:字处理软件Word 2010——知识点整理
  17. svn clean up 特别慢
  18. 国内热门ERP软件有哪些推荐?
  19. WIN7 声音图标不见
  20. r语言员工离职_使用R机器学习进行员工离职预测系列(一)

热门文章

  1. 连续四年百度Android岗必问面试题!Android校招面试指南
  2. bash 的相关配置
  3. python里的apply,applymap和map的区别
  4. block传值 链接
  5. 都客仿站系列教程四:javascript入门
  6. 几张图可以理解GC JVM调优的内容
  7. RUNOOB python练习题44
  8. 内置的常用协议实现模版
  9. Java 9 新功能之 HTTP2 和 REPL
  10. WebSnapshotsHelper(HTML转换为图片)