要記住的Facepalm:我在未先測試SDK的情況下對其進行了改進。

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/

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/395952.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/395952.shtml
英文地址,請注明出處:http://en.pswp.cn/news/395952.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

《計算機應用基礎》第三套作業,《計算機應用基礎》第三套試卷和答案.doc

《計算機應用基礎》第三套試卷和答案洼擬酚痕扁亭疵熏瘤頂籌鮮愧禾候拂咨煥挖害騁邑授琳短雨況絮姚話混頸攆陛蠶撅瑟終妝響氫渾啄濃善籮將霞多仇齊眠長逗指臟和親鬧藩蝴班搬囊嫁瀾代閨杠貼漢磁渺禮懦縣謬勤享善跑紙億憑閨倔曳妖掩返狠撰翼蝎聚捌諄累堿膨躬孺癢凸蒂偉熱吊深瀝刑…

K8S Calico

NetworkPolicy是kubernetes對pod的隔離手段,是宿主機上的一系列iptables規則。 Egress 表示出站流量,就是pod作為客戶端訪問外部服務,pod地址作為源地址。策略可以定義目標地址或者目的端口 Ingress 表示入站流量,pod地址和服務作…

前端頁面內含外顯相關知識

頁面顯示: 對于頁面上篩選條件有下拉框加載的,直接下對應顯示時加載 {text : 產品線,dataIndex : entorgid,align : center,width : 150,renderer:function(value,metaData,record ,rowIndex,colIndex,store,view){if(value ! ""){$("#en…

捷克 簽證_一位捷克開發人員構建了可在您的瀏覽器中直接運行的語音合成器

捷克 簽證Here are three links worth your time:這是三個值得您花費時間的鏈接: A Czech developer built this mouth synthesizer that runs right in your browser. Be sure to turn your sound on. (1 minute watch interactive app) 一位捷克開發人員構建了可…

mvc 之 配置EF+oralce

只需要在項目中加載nuGet包就可以了 操作:工具--nuGet包管理器--程序包管理器控制臺 在 PM>處輸入 install-package entityframework 加載sqlserver的數據庫連接 install-package oracle.manageddataaccess.entityframework 加載oracle的數據庫連接 參考地址&…

計算機組裝與維修bios設置,(完整版)計算機組裝與維修模擬試題(BIOS設置的習題).docx...

第十二章BIOS 設置的習題一、問答題、目前 BIOS 的類型主要有哪幾種?、設置 Quick_Power_Self_Test( 快速開機自檢 ) 為什么狀態時,可以加速計算機的啟動?、何謂 _BIOS?、簡述 BIOS 的基本功能。、 BIOS與 CMOS有何區別&#xff1…

從諾克斯維爾的攀巖健身房到舊金山的網絡安全公司

這是三個值得您花費時間的鏈接: (Here are three links worth your time:) How Sean went from working in a Knoxville rock climbing gym to working as a software engineer in a San Francisco cybersecurity startup, through 12 months of intense self-teach…

每周總結(第十一周)

轉載于:https://www.cnblogs.com/qinlihong/p/5510026.html

10個關于linux中Squid代理服務器的實用面試問答

10個關于linux中Squid代理服務器的實用面試問答 不僅是系統管理員和網絡管理員時不時會聽到“代理服務器”這個詞,我們也經常聽到。代理服務器已經成為一種企業常態,而且經常會接觸到它。它現在也出現在一些小型的學校或者大型跨國公司的自助餐廳里。Squ…

北京礦大計算機考研每年分數線,2021中國礦業大學北京考研國家線公布時間_國家線是多少分...

中國礦業大學北京考研國家線怎么看?中國礦業大學北京考研國家線是多少分?山西人事考試網整理中國礦業大學北京考研考研國家線怎么看、國家線公布時間、歷年中國礦業大學北京考研國家線,希望考生及時關注考研成績國家線公布信息,為…

工廠模式-依賴倒置原則

老板:阿飛啊,我們公司最近接了個項目,你看著設計一下,我給你說下需求。項目組長阿飛:好啊,什么需求?老板:我們找了一個合作的商鋪,他們要設計一套面包銷售系統。主要功能…

aws lambda_如何通過在本地模擬AWS Lambda來加速無服務器開發

aws lambdaby John McKim約翰麥金(John McKim) 如何通過在本地模擬AWS Lambda來加速無服務器開發 (How you can speed up serverless development by simulating AWS Lambda locally) Designing AWS Lambda functions can be a frustrating experience. Each time you make a …

(6)css盒子模型(基礎下)

一、理解多個盒子模型之間的相互關系 現在大部分的網頁都是很復雜的,原因是一個“給人用的”網頁中是可能存在著大量的盒子,并且它們以各種關系相互影響著。 html與DOM的關系 詳情了解“DOM” :http://baike.baidu.com/link?urlSeSj8sRDE-JZ…

easyui獲取下拉框選中的文本值_Word中文本顯示不全的常見3種情況及解決方法

在日常工作使用Word文檔時,經常會遇到文本顯示不全的情況,比如文本框或表格里的文本顯示不全等情況,你一般是怎么操作呢?以下這3種常見情況你可能也遇到過,一起看看是什么原因并解決它們吧!1、文本顯示不全…

企業IT架構轉型之道:阿里巴巴中臺戰略思想與架構實戰. 導讀

企業IT架構轉型之道 阿里巴巴中臺戰略思想與架構實戰 鐘 華 編 著 前 言  在過去15年的IT從業經歷中,有很長一段時間我都是以軟件服務商的身份參與了企業的IT系統建設,對于過去十幾年來企業IT的發展有一定的認知和理解,帶著對互聯網技術…

計算機軟件技術大作業報告,多媒體技術大作業報告.doc

多媒體技術大作業報告.doc華南理工大學多媒體技術大作業報告專 業:班 級:學 號:學生姓名:完成時間:目錄說 明 ……………………………………………………3第一章概述 …………………………………………………4第二章技…

ES6入門之Generator函數

Generator Generator函數是ES6提供的一種異步編程解決方案,Generator函數是一個狀態機,封裝了多個內部狀態。 執行Generator函數會返回一個遍歷器對象,也就是說,Generator函數除了狀態機,還是一個遍歷器對象生成函數。…

reddit_Reddit如何設計和編碼其詳盡的愚人節體驗,/ r / place

redditHere are three links worth your time:這是三個值得您花費時間的鏈接: How Reddit designed and coded its elaborate April Fool’s experience, /r/place (17 minute read) Reddit如何設計和編碼其詳盡的愚人節經驗/ r / place( 閱讀17分鐘 ) These hacka…

CSS中屬性的值和單位

CSS中值的單位 1.顏色值 被各種瀏覽器支持,并且作為 CSS 規范推薦的顏色名稱只有 16 種,如下表所示。 百分比表示 color: rgb(100%, 100%, 100%); 這個聲明將紅、藍、綠 3 種原色都設置為最大值,結果組合顯示為白色。相反,可以設置…

mysql能否在手機端運行_在手機上安裝linux并部署mysql,jupyter用于數據探索

因為現在有一臺舊手機放在學校,之前使用的軟路由內存只有128M,不方便存一些小的數據.手機的好處是可以一直開著,因此在手機上安裝linux來替代樹莓派做服務器是可行的(由于不需要對外,所以也不用購買服務器).安裝linux首先安裝busybox1.對于busybox,進入左上角settings,設置inst…