mixi-inc/AndroidTraining 㧠Android ã¢ããªéçºã®å¦ç¿ä¸
ã¹ãã¼ããã©ã³ã®ã¢ããª*1ãä½ããããã«ãªã£ã¦ããããã¨æããGitHub ã«ãã mixi-inc/AndroidTraining ã§å¦ç¿ãããã¨ã«ãã¾ããã
éçºç°å¢
AndroidStudio
AndroidTraining ã§ã¯ Eclipse ã« ADT ãå
¥ãã¦ãã¾ãããç§ã¯ IntelliJ ããã¼ã¹ã¨ãªã£ã¦ãã Android Studio ãå©ç¨ãã¦ãã¾ããIntelliJ ã«ãã³è¯ããã§ã
Android Studio 㯠http://developer.android.com/sdk/installing/studio.html ããããããã¦ã³ãã¼ããã¾ããã
ãã¦ã³ãã¼ããããã¼ã¸ã§ã³ã¯ 0.3.2 ã ã£ãã®ã§ãããèµ·åæã«ææ°çããããï¼ã¨éç¥ãããã®ã§å³æ´æ°ã㦠0.4.2 ã«ãªã£ã¦ãã¾ãã
Android Studio ãèµ·åããããã¾ãæåã« SDK ããã¦ã³ãã¼ããã¾ããããã¼ã«ãã¼ã«ãã SDK Manager ã®ã¢ã¤ã³ã³ãã¯ãªãã¯ãã¦ãSDK Manager ããå¿ è¦ãããªãã®ã«ãã§ãã¯ãå ¥ã㦠Install Package ãã¦ãã¾ããããããååã§ã¯ãæåããããã¤ãã®ããã±ã¼ã¸ãé¸æã»åé¤ããã¦ããç¶æ ã ã¨æãã®ã§ããã®ã¾ã¾ Install Package ãã¿ã³ãã¯ãªãã¯ãããããªè¨æ¶ãããã¾ãã
Genymotion
Android ã®é«éã¨ãã¥ã¬ã¼ã¿ã§ããhttp://www.genymotion.com/ ããå
¥æã§ãã¾ããè¦ã¢ã«ã¦ã³ãç»é²ã
Genymotion 㯠VirtualBox ä¸ã§åä½ããã®ã§ãVirtualBox ãå¿
è¦ã§ãã
http://dev.classmethod.jp/smartphone/android/genymotion-install/ ããããåèã«ã¤ã³ã¹ãã¼ã«ãã¾ããã
SDK ã«ãæ¨æºã§ã¨ãã¥ã¬ã¼ã¿ãã¤ãã¦ããã®ã§ãããIntel x86 Emulator Accelerator (HAXM) ãæå¹ã«ãã¦ãã¡ãã£ã¨é ãæããããã¾ããGenymotion ã¯èµ·åãæç»ãååã«æ©ããã¾ãã¨ãã¥ã¬ã¼ã¿èªä½ã®ã¦ã£ã³ããµã¤ãºã«åããã¦æ¡å¤§/縮å°ããããGPSãã«ã¡ã©ãªã©ã®å½è£ ãç°¡åã«ã§ããã®ãè¯ãã§ãã
Genymotion Plugin
AndroidStudio ã§ãã«ãããã¢ããªã±ã¼ã·ã§ã³ã®ãããã¤å
ã¨ã㦠Genymotion ãé¸æã§ããããã«ããããã«å¿
è¦(ã¨æã)ãªã®ã§å
¥ãã¦ããã¾ãã
AndroidStudion ã® Preferences -> Plugin 㧠Browse Repositories ãã¿ã³ãã¯ãªãã¯ããã¨ãã©ã°ã¤ã³ã®ä¸è¦§ã表示ããã¾ãããã®ä¸ãã Genymotion ãã©ã°ã¤ã³ãé¸æã㦠Download and Install ãã¾ãã
Tips
AndroidStudio ã使ã£ã¦ãã¦ããªãã ãããããªããã©ãããããªã¨æã£ãæã«ãã¦ããäºã®ã¡ã¢ã§ãã
ã¬ã¤ã¢ã¦ããã¡ã¤ã«ã«è¨è¿°ãã¦ãã FQCN ã赤ããªã£ã¦ãã*2
ã¡ãã¥ã¼ãã File -> Invalidate Caches / Restart... ãã¯ãªãã¯ãã表示ããããã¤ã¢ãã°ã® Invalidate and Restart ãã¯ãªãã¯ãã¦ãã£ãã·ã¥ã®ã¯ãªã¢ããã³åèµ·åã§è§£æ¶ãã¾ããã
ä¾åã©ã¤ãã©ãªã追å ããã
ä¾åã©ã¤ãã©ãªãå©ç¨ããã¢ã¸ã¥ã¼ã«ã® build.gradle ã« dependencies ãããã¯ã追å ãã¾ãã
ä¾ãã° twitter4j-stream ã追å ãããªãã°ä»¥ä¸ã®ããã«ãªãã¾ãã
dependencies { compile group: 'org.twitter4j', name: 'twitter4j-stream', version: '3.0.5' }
Gradle ã«ã¤ãã¦ã¯ã¦ã¼ã¶ã¬ã¤ããæ¥æ¬èªè¨³ããããããããæ¹ããã®ã§ããããåèã«ããã¨è¯ããã¨æãã¾ãã
ã¦ã¼ã¶ã¬ã¤ãã®æ¥æ¬èªè¨³ç㯠http://gradle.monochromeroad.com/docs/userguide/userguide.html ã«ãªãã¾ãã
ä¾åã©ã¤ãã©ãªã®è¿½å ãåæ ãããªãï¼
ã¡ãã¥ã¼ãã Tools -> Android -> Sync Project with Gradle Files ãã¯ãªãã¯ãã¾ãããã¼ã«ãã¼ã«ãããã®ã§ãã¡ãã§ãOKã§ãã
ã³ã¼ãè£å®ããã¨ãã«åè£ã«åºã¦ããããã«ãªãã¾ãã
ä¾åã©ã¤ãã©ãªè¿½å ãããããã«ãã«å¤±æããããã«ãªã£ã
ãã«ãã«å¤±æãã"META-INF/LICENSE.txt" ãéè¤ãã¦ãããï¼ã¿ãããªã¡ãã»ã¼ã¸ãåºã¦ããç¶æ³ã®ãã¨ã§ãã
build.gradle ã® android ã® packagingOptions ãããã¯ã« exclude ã«ä¸è¨ã®ãã¡ã¤ã«åãæå®ãã¾ãã
android { ... packagingOptions { exclude 'META-INF/LICENSE.txt' } }
*1:ç§ã®å¨ãã§ã¯ããããã¯ã©ã¤ã¢ã³ãã¢ããªãã¨å¼ç§°ããã¦ããæ°ãããããWindows ä¸ãªã©ã§åä½ããã¢ããªã¨åºå¥ãã¤ããªãã¦éåæãæãã
*2:AndroidStudioå´ã§ã¯ã©ã¹ããã¾ãèªèã§ãã¦ããªãã¿ããã§ããããã«ãã¯Gradleãããã®ã§ã§ãã¾ããã