è²·ç©æ å ±äºæ¥é¨ã®å «æ¨ã§ããã¯ãã¯ãããç¹å£²æ å ±ã®Androidé¨åãæ å½ãã¦ãã¾ããæ®æ®µã¯ã¯ãã¯ãããã®Androidçï¼ä»¥å¾ãæ¬ä½ã¢ããªã¨ãã¾ãï¼ã®éçºããã»ã¹ã®ä¸ã§ç¹å£²æ å ±ã®æ©è½ãéçºãã¦ãã¾ãã
æ¬ã¨ã³ããªã§ã¯ç´°ããªæè¡çè² åµ
ã解æ¶ããçºã«æ¬ä½ã¢ããªã®éçºãã¼ã ãè¡ã£ã¦ããæLintæ´»åãç´¹ä»ãã¾ãã
2å¹´è¿ãçµã¤æ¬ä½ã¢ããªã®ã³ã¼ããã¼ã¹
ç§ãè²·ç©æ å ±äºæ¥é¨ã«æå±ããåã¯æ¬ä½ã¢ããªã1ããæ¸ãç´ããã¼ã ã§åãã¦ãã¾ãããæ¸ãç´ãå§ããã®ã¯2013å¹´10æãããªã®ã§ãããã2å¹´ãçµã¨ãã¨ãã¦ãã¾ãã2å¹´åã«è¨è¨ãããæ¬ä½ã¢ããªã¯ç¾å¨ã§ã¯ããã17ä¸è¡ãè¶ããæ¥ã ã©ãã©ãå¤æ´ãå ãããã¦ãã¾ãã
ãããã®å¤æ´ã®ä¸ã«ã¯æ®å¿µãªããæªãã³ã¼ããå«ã¾ãã¦ããå ´åãããã¾ãããã¹ããã¥ããã³ã¼ãããã¹ãããªãã³ã¼ããã¬ãã¥ã¼ã«å¯¾ããå ´å½ãããªå¯¾å¿ãç·æ¥ã®bug fixã®ããã«è¿½å ãããæ±ãã³ã¼ããã¹ã±ã¸ã¥ã¼ã«ä¸ããããããè¾¼ãã ã³ã¼ããminSdkVersionã«å¯¾å¿ããããã®ã³ã¼ããdeprecatedã«ãªã£ã¦ãã¾ã£ãAPIã®å©ç¨ãã¡ã³ããã³ã¹ãããªããªã£ãã©ã¤ãã©ãªã®å©ç¨ãªã©ç´°ããªåé¡ãæ¥ã å¢ãã¦ãã£ã¦ãã¾ãã
ç´°ããªæè¡çè² åµã®å¼å®³
æè¡çè² åµã®ãã¡å¤§ããªãã®ã¯issueãç«ã¦ã¦ãã¤ã«ã¹ãã¼ã³ãè¨å®ãéçºããã»ã¹ã«ä¹ããã®ã§ããã¾ã§è´å½çãªåé¡ã«ã¯ãªãã¾ãããã©ã¡ããã¨ããã¨ä»¥ä¸ã®ãããªæ§è³ªã®ã³ã¼ããé·ãæ®ããã¡ã§ãã
- å¤ãå®è£ æ¹éã ãåä½ã¯æ£ãããã次ã«å¤æ´ããæã¾ã§æ¾ç½®ããã¦ãã
- ãã¹ããæ¸ããªãç¶æ ã ããã¹ããæ¸ããç¶æ ã«ããçºã«ã¯å½±é¿ç¯å²ã大ãããã
- æ©è½è¿½å ã®çºã«å¤ãã®å¤æ´ãå¿ è¦ã ãå®å½¢çãªããã³ããã«è¿ãå¤æ´ã§æ¸ãã§ãã¾ãæ§é ã®åè¨è¨ã¸ã®ã¢ããã¼ã·ã§ã³ãä½ã
- Lintè¦åãåºã¦ãããåé¡ã¯èµ·ãã£ã¦ããªã
ããããã³ã¼ãã¯æ£ããåä½ãã¦ãã¦è´å½çãªåé¡ããã¾ãèµ·ãããªãããã«è¦ããããä¿®æ£ã¸ã®ã¢ããã¼ã·ã§ã³ãä½ã大æµå¾åãã«ãªãã¾ã(ãããã¯æ°¸é ã«å¯¾å¿ããã¾ãã)ãããããã³ã¼ããæ®ãã¦ãããªã¹ã¯ã¨ãã¦æ¬¡ã®ãããªäºãèãããã¾ãã
- æ¬ä½ã¢ããªã«åãã¦å¤æ´ãå ãã人ãæªãè¦æ¬ã使ã£ã¦ã³ã¼ããæ¸ãã¦ãã¾ã
- æ§é çãªåé¡ã«ããæ°æ©è½ã®è¿½å ã³ã¹ããæ¢åæ©è½ã®å¤æ´ã³ã¹ãã®å¢å
- å¯èªæ§ã®ä½ä¸ã¨æ´å²ççµç·¯ãå¦ç¿ããã³ã¹ãã®å¢å ãå¦ç¿ä¸è¶³ã«ãããã°ã®æ··å ¥
- æ°ããæ¹éãé©ç¨ãããã¼ãã«ãä¸ãã
ãããã¯æ¹åããããã©æãä»ããæããªãåé¡
ã¨ãã¦åå¨ãã¤ã¥ãã¦ãã¾ããã
æ½å¨çãªãªã¹ã¯ãå¯è¦åãã
ããæã®æ¯ãè¿ãã§ãééã£ã¦ãããã©åãã³ã¼ããæ¾ç½®ããã¦ããããåé¡ãèµ·ãã£ããã¨ãããªã¹ã¯ããã®ã¾ã¾ãã°ã«ãªã£ã¦ç¾ãããããªProblemãåºã¦ãã¾ãããããã«å¯¾ãã¦ãã¾ãã¯æ½å¨çãªãªã¹ã¯ãå¯è¦åãããã¨ããTryãè¡ããã¨ã«ãã¾ããã
å
·ä½çã«ã¯build.gradle
ã«Lintè¦åã表示ããã³ã³ãã¤ã«ãªãã·ã§ã³ã追å ãã¦æªããè¦åãè¦éããªãããã«ããããã¨ãããã®ã§ããã
allprojects { gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:all,-serial" } } }
ããã«ãããã¢ããªããã«ããã度ã«Android Studioã®Messagesã®é¨åã«å¤§éã®è¦åãåºãããã«ãªãã¾ãããã¾ãã¯ããããããã¯ã¢ãããã¦æ¹åããç¿æ £ãã¤ããã¨ããã®ã§ã¯ãªããã¨èãã¾ããã
Lintè¦åãéªé
Lintè¦åã®è¡¨ç¤ºãå°å ¥ãã次ã®æ¯ãè¿ãã§ããã«ããã度ã«åºã¦ãã大éã®è¦åãéªéãã¨ããProblemãåºã¦ãã¾ããããããã«è¦åããã¨ã«æ¹åç¹ãæ´ãåºãã®ãç®çã§ããã°ä¾¿å©ã§ãããæ®æ®µã®éçºã«ããã¦ã¯ãã¤ãºã§ããç¹ã«ã³ã³ãã¤ã«ã¨ã©ã¼ã¨ãªã£ãæã«è¦åã¨ã¨ã©ã¼ãæ··ãã£ã¦ãã¾ãåå ãæ¢ãã¥ãããªã£ã¦ãã¾ã£ã¦ãã¾ãããã¾ãæå¾ ãã¦ããããæ¹åãä¿é²ããã¦ãã¾ããã§ããã
Lintè¦åã®è¡¨ç¤ºãã®ãã®ã¯æç¨ãªã®ã§å¤ããããªãããããæ®æ®µéªéã«ãªãã®ã§ãªãã¨ãããããä»ã«è¯ãæ¹æ³ã¯ãªããããã®æ¯ãè¿ãæç¹ã§ã®ç´°ããªæè¡çè² åµ
ã«å¯¾ããææ
ãæ´é ããã¨ãã®ããã«å解ã§ãããã§ãã
- æ®æ®µã®éçºã®è² æ ã¯å¢ãããããªã
- æ¹åã¯ãã¦ãããããã¢ããã¼ã·ã§ã³ãããããªã
- åçºã®å¤§ããªæ¹åã§ã¯ãªãå°ããªæ¹åãç¶ç¶çã«ããã
- Lintè¦åã¯æç¨ã ãæ¯ååºãã®ã¯ã¤ã©ã¤ã©ããã®ã§æ¶ãå»ããã
ãããã®ææ ããã¾ãã«ãã¼ããå¿ è¦ãããããã§ãã
æLintæ´»åã¸
ãæç·´...æãã...æãã...æLint!ã
æ¯ãè¿ãã®ããªãç§ã¯é©å½ã«ã¤ã¶ããã¾ãããLintè¦åã®ã¤ã©ã¤ã©ãããã«æã«ãããã¨ä¿®æ£ããæéãä½ã£ããããããããªããã¨ããçºæ³ã§ããã¯ããããã¡ã³ãã¼ãããããã®ã§ã¯ãã¨ããåå¿ãå¾ãããæ©éTryãããã¨ã«ãªãã¾ããã
æLintã®æ¹éã¯æ¬¡ã®éãã§ãã
- 主ã«è»½å¾®ãªLintè¦åãçä»ãã(ãã«ãã®ãã³ã«åºã¦ããè¦åãé§éãã¦ãã)
- ã¬ãã¥ã¼ã®è² æ ãéã¿ã¤ã¤Android LintãFind Bugsãªã©ã®è¦åããå¤ãå®è£ æ¹éãçä»ãã¦ããã
- å¤æ´ã¯å°éã§ãã(ããè¦åããã¡ã©ã«å ¨ã¦çä»ããªãã¦ããã)
- å®æ½ã¯ä»»æã§ãã
ããã¾ã§ãããªã£ã¦ããè¦åã®ä¸ããèªä¸»çã«åé¡ãæ¢ãã ãæ¹æ³ã®å ´åã©ããã¦ãä¿®æ£ãå ããã«è¶³ãã»ã©ã®åé¡ãªã®ãã¨èãã¦ãã¾ã£ã¦æãæ¢ã¾ã£ã¦ãã¾ã£ã¦ãã¾ãããæLintæ´»åã¨ããä»çµã¿ãå°å ¥ããäºã«ãã£ã¦ä¿®æ£ã¸ã®å¿ççãã¼ãã«ã大ããä¸ããã¾ããã
æLintæ´»åã®çµé
éç¨ãå§ãã¦ããã2ã¶æç¨åº¦ãçµéãã¦ãã¾ããããã¾ã§ã«ä½ãããæLintã®PRã¯ããã20件ã»ã©ã§ããã¾ã ç´°ã ã¨ãã£ãæãã§ããç¶ç¶çã«æ¹åãã§ãã¦ãã¾ãã以åã¯ã»ã¼0ã ã£ãã®ã§å¤§ããªé²æ©ã§ãã
æLintæ´»åã¯ç´°ããªæè¡çè² åµ
ã¸ã®å¯¾å¿ã«å¯¾ããå種ææ
ãã«ãã¼ã§ãã¦ããããã«è¦ãã¾ãã
- æ®æ®µã®éçºã®è² æ
ã¯å¢ãããããªã
- ä»»æã軽微ã§ããã®ã§æ°ãåããæã«ããã
- æ¹åã¯ãã¦ãããããã¢ããã¼ã·ã§ã³ãããããªã
- 軽微ãªä¿®æ£ã§ãæ¹åãéãªã£ã¦ãããæãæ°åãä¹ããªãã¨ãã¯ãµã¯ãã¨PRãã¦å¼¾ã¿ãã¤ããã¨ãã£ã使ãæ¹ãã§ãã
- åçºã®æ¹åã§ã¯ãªãç¶ç¶çã«æ¹åããã
- ä¿®æ£ä¸ã«ä»ã®ä¿®æ£ç®æãçºè¦ãããç¿æ¥ã«æã¡è¶ãã°ããã¨æããã
- Lintè¦åã¯æç¨ã ãæ¯ååºãã®ã¯ã¤ã©ã¤ã©ããã®ã§æ¶ãå»ããã
- ã¤ã©ãã¨ãã¦ä¿®æ£ããããªããä¿®æ£ãã¦ãããã
æLintã®ä¸ã§bugãçºè¦ãã¦æ½°ããããæLintã®ç¯å²ã§ã¯ä¿®æ£ã§ããªãåé¡ã®æ¤åºãã§ããããªã©è¯ãå¹æãããããã¦ãã¦ãç¿æ £ã¨ãã¦å®çããããªæå¿ããæãã¦ãã¾ãã
ãããã«
以ä¸ãæ¬ä½ã¢ããªã®éçºãã¼ã ãè¡ã£ã¦ããæLintæ´»åã®èæ¯ã¨å
容ã§ããããã«è³ãã¾ã§æ§ã
ãªè©¦ã¿ããã¦ãã¾ããããªããªããã¾ãã¯ã¼ã¯ãã¦ãã¾ããã§ãããä»æãã°ææ
ãã«ãã¼ãã
ã¨ããç¹ãéè¦ã ã£ãã®ããªãã¨æãã¾ããçæ§ãæLintæ´»åã試ãã¦ã¿ã¦ãã ããã