"페이스북 안드로이드앱 개발환경 구축"의 두 판 사이의 차이

43번째 줄: 43번째 줄:


==SDK 컴파일==
==SDK 컴파일==
*D:\adt-bundle\facebook-android-sdk-3.0 에 있는 facebook 폴더를 [[D:\workspace\adt]]로 복사
*D:\adt-bundle\facebook-android-sdk-3.0 에 있는 facebook 폴더의 이름을 FacebookSDK로 변경
*facebook 폴더의 이름을 FacebookSDK 로 변경
*FacebookSDK 폴더를 [[D:\workspace\adt]]로 복사


*ADT --- File --- Import...
*ADT --- File --- Import...

2013년 1월 12일 (토) 18:12 판

Crystal Clear action info.png 작성 중인 문서입니다.
facebook android app development
android app development with facebook SDK
페이스북 안드로이드 앱 개발, 안드로이드 페이스북 SDK

1 사전 작업

2 SDK 다운로드

그러면 facebook-android-sdk-3.0 폴더 아래에 bin, docs, facebook, sample 폴더와 파일 몇개가 생성된다.[1]

3 Facebook 앱 설치

3.1 가상 기기

가상기기 실행
  • ADT --- Window --- Android Virutal Device Manager
  • "Android Virutal Device Manager" --- AVD_for_Nexus_S_by_Google 선택 --- [Start...]
  • 다음과 같이 가상기기(AVD)가 켜진 상태를 확인한 후 설치를 진행
C:\Users\jmnote>d:

D:\>cd D:\adt-bundle\sdk\platform-tools

D:\adt-bundle\sdk\platform-tools>adb devices
List of devices attached
emulator-5554   device
D:\adt-bundle\sdk\platform-tools>adb install D:\adt-bundle\facebook-android-sdk-3.0\bin\FBAndroid-2.0.apk
136 KB/s (14285729 bytes in 102.329s)
        pkg: /data/local/tmp/FBAndroid-2.0.apk
Success
→ 설치 완료. 가상기기의 App Drawer에 페이스북 앱이 있는지 확인해보자.[2]

3.2 실제 기기

4 SDK 컴파일

  • D:\adt-bundle\facebook-android-sdk-3.0 에 있는 facebook 폴더의 이름을 FacebookSDK로 변경
  • FacebookSDK 폴더를 D:\workspace\adt로 복사
  • ADT --- File --- Import...
  • "Import" --- General --- Existing Projects into Workspace --- [Next >]
  • "Import Projects" --- (O) Select root directory: D:\workspace\adt\FacebookSDK --- [Refresh] --- [Finish]

Package Explorer에 FacebookSDK 프로젝트가 추가되었다. Problems 창에 다음과 같은 오류가 나온다.

Unable to resolve target 'android-8'
Unable to resolve target 'android-8'
The project cannot be built until build path errors are resolved
Project 'facebook' is missing required source folder: 'gen'
  • Package Explorer --- FacebookSDK 우클릭 --- Properties
  • "Properties for FacebookSDK" --- Android --- [V] Android 4.2 --- [OK]
  • Package Explorer --- FacebookSDK 우클릭 --- Android Tools --- Fix Project Properties

그러면 Error가 모두 사라진다.[3] 대신 아래와 같이 Warning이 8개 발생한다.

The field ViewGroup.LayoutParams.FILL_PARENT is deprecated (5개)
The method setBackgroundDrawable(Drawable) from the type View is deprecated (2개)
Unsupported @SuppressWarnings("resource") (1개)

Warning이므로 그냥 두어도 별 문제가 안된다.[4] Warning 메시지가 거슬린다면 Problems 에서 Warnings 묶음을 선택하여 삭제하면 된다.

이제 Package Explorer --- FacebookSDK --- bin --- facebooksdk.jar가 있는지 확인[5]

5 MyFacebookApp

  • File --- New --- Android Application Project
  • "New Android Application" --- Application Name: My Facebook App[6] --- [Next >]
  • "Configure Project" --- [Next >]
  • "Configure Launcher Icon" --- [Next >]
  • "Create Activity"[7] --- [Next >]
  • "New Blank Activity" --- [Finish]

FacebookSDK를 라이브러리로 지정

  • Package Explorer --- MyFacebookApp 우클릭 --- Properties
  • "Properties for MyFacebookApp" --- Android --- "Library" --- [Add...]
  • "Project Selection" --- FacebookSDK 선택 --- [OK]
  • [OK]

6 같이 보기

7 주석

  1. 압축프로그램에 따라 zip 파일의 이름을 딴 facebook-android-sdk-3.0 폴더를 생성하지 않는 경우도 있는데, 이때는 직접 폴더를 만들어 넣어주면 된다.
  2. 바탕화면에는 나타나지 않는다...
  3. gen 폴더를 자동생성하면서 정상화된 것이다.
  4. Warning 메시지 대부분이 deprecated인데... 향후 SDK 버전이 올라가면서 적절히 조치가 될 것이다...
  5. Error가 없기 때문에 컴파일 결과물인 facebooksdk.jar이 생성된 것
  6. 앱 이름만 입력하면 프로젝트명과 패키지명은 자동으로 채워진다.
  7. BlankActivity가 기본값

8 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}