Bài giảng Phát triển phần mềm mã nguồn mở: IDE và SDK được biên soạn nhằm cung cấp cho người học các kiến thức: Giới thiệu Eclipse, Android SDK, Zend Studio. Mời các bạn cùng tham khảo nội dung chi tiết.
Trang 1IDE và SDK
Phát triển phần mềm mã nguồn mở
Trang 2Nội dung
• Giới thiệu Eclipse
• Android SDK
• Zend Studio
Trang 3Giới thiệu Eclipse
Trang 4• Eclipse là IDE mã nguồn mở
• Cung cấp công cụ để soạn thảo code, biên dịch, và
• Cần phải cài JDK để chạy Eclipse
• Eclipse có thể được tải về từ…
– http://www.eclipse.org/downloads/packages/
– Cần chọn “Eclipse IDE for Java Developers”
Trang 5Cài đặt Eclipse
• Giải nén file zip vào một thư mục nào đó.
• Trên windows
– Thường giải nén vào thư mục C:\eclipse\
– Rồi tạo shortcut trên desktop để thi hành
Trang 6Chọn Workspace
• Với Eclipse, toàn bộ mã nằm trong workspace
• Một workspace chỉ là nơi cất giữ mã nguồn
• Eclipse cho phép có nhiều workspaces – mỗi workspace được thiết kế theo cách riêng
• Chọn nơi muốn lưu trữ file, rồi nhấp OK
Trang 7Welcome to Eclipse
• Lần đầu tiên làm việc
với Eclipse, ta sẽ thấy
màn hình.
• Từ đây ta có thể xem
khái quát về platform,
tài liệu hướng dẫn,
code mẫu, v.v…
• Nhấp vào mũi tiên bên
phải để lấy IDE
Trang 8Các thành phần Eclipse IDE
Menubars
Full drop down menus plus quick
access to common functions
Package Explorer Pane
This is where our
projects/files are listed
Miscellaneous Pane
Various components can appear in this pane – typically this contains a console and a list of compiler problems
Task List Pane
This contains a list of
“tasks” to complete
Trang 9Tạo Project mới
• To create a project: File New Java Project
Trang 10Tạo Project mới
Trang 11Thư mục src
• Eclipse tự động tạo thư mục src để chứa mã
Trang 12Tạo Class
• Nhấp vào nút New, rồi chọn Class
Trang 13Class mới được tạo
Directory structure for
package and actual java file
created automatically
Source is loaded into the editor pane, already stubbed out
Source displayed in a hierarchical fashion listing each method name
Trang 14Biên dịch mã nguồn
• Eclipse tự động biên dịch mã nguồn
Packages/Classes
with errors are
marked with a red X
Often Eclipse may have
suggestions on how to fix the
problem – if so, a small light
bulb will be displayed next to the
line of offending code
Error underlined with red squiggly line (just like spelling errors in many word processors)
Methods with errors are marked with a red X
Position in file is marked with a red line – 1 click allows you to jump to line with error
The Problems tab will contain a tabular representation of all errors across all files of all open projects
Trang 15Biên dịch mã nguồn
• Eclipse đề nghị thay printn thành print hay println
Trang 16Running Code
• Nhấp phải vào class rồi chọn Run As Java Application
Trang 17Running Code
• Kết quả xuất hiện trên Console tab
Trang 18Re-Running Code
Trang 19Debugging Code
• Eclipse có bộ gỡ rối đẹp
• Set break points ở lề bên trái
Trang 20Debugging Code
• Nhấp phải vào class và chọn Debug As Java Application
Trang 21Debugging Code
• Lần đầu tiên debug sẽ thấy dialog sau
Trang 22Quan sát Debug
List of breakpoints
These buttons allow you
to step through the code
Note new Debug perspective – click Java to return to normal
Variables in scope are listed here along with their current values (by right clicking you can change values of variables as you program is running)
Current high level location (class and method)
This pane shows the current line of code we broke on
Output console, just like
in normal run mode
Trang 23• Windows Users: cần cài đặt Motorola
Driver trực tiếp ( EN/Support-Homepage/Software_and_Drivers/USB-and-PC-
http://www.motorola.com/Support/US-Charging-Drivers )
Trang 24Android SDK
• Mỗi lần cài là mở trình SDK Manager
• Cài các gói cần thiết
• Tạo thiết bị ảo Android Virtual Device (AVD)
Trang 25SDK Manager
Trang 26AVD
Trang 27ADT Plugin
• Vào Eclipse, chọn Help → Install New Software
• Nhấn ‘Add’ ở góc phải trên
• Nhập:
– Name: ADT Plugin
– Location: https://dl-ssl.google.com/android/eclipse/
• Nhấn OK, chọn ‘Developer Tools’, nhấn Next
• Nhấn tiếp Next và nhấn Finish
• Sau đó khởi động Eclipse
• Định vị SDK (3 slides tiếp theo)
– Phải thực hiện điều này mỗi lần khởi động project mới ở nơi mới (ít nhất là trên Windows)
Trang 28ADT Plugin
Trang 31ADT Plugin
Trang 32ADT Plugin
Trang 33Tạo Project
Trang 34Chọn thông tin và nhấn Finish
Trang 36Zend Studio
Trang 37Cài đặt ZS trên Windows
Trang 38Cài đặt ZS trên Eclipse