연습
Android Youtube API 사용하기 - 0. 라이브러리에 추가하기 -
JunkMam
2015. 12. 2. 00:00
Android Youtube을 제작할려고, 이런 기록을 남긴다.
Google에서 Youtube API라고 하여, Youtube을 쉽게 연동할 수 있게 하는 장치가 있다.
이걸 이용해서 안드로이드 Youtube API을 제공하고자 한다.
먼저, Google 에서 제공하는 API 사이트에 들어가야 된다. 1
사이트에 들어가서 다운로드에 가면, YouTubeAndroidPlayerApi-1.2.2.zip 라는 파일이 있다.
이 파일을 다운 받은 후 라이브러리에 추가해야한다.
압축을 풀면 다음과 같은 파일들이 존재하게 된다.
docs는 API에 대한 책자 정보를 제공하고, libs는 Android Youtube 라이브러리가 들어가 있다.
sample은 예제들이 들어가 있으니, 참조하면 도움이 될 것이다.
먼저 적용하기 위해서 안드로이드 프로젝트를 만든 후.
프로젝트 폴더의 libs 폴더에 들어가서 libs에 있는 내용을 복사한다.
프로젝트 폴더 >> app >> libs 안에 라이브러리가 들어가 있어야된다.
이렇게 들어가면 된다.
이 후에 라이브러리를 제대로 처리하기 위해선, app을 수정해야 된다.
app의 내용은 다음과 같게 된다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | apply plugin: 'com.android.application'android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.example.sung.android" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.0' compile files('libs/YouTubeAndroidPlayerApi.jar') } | cs |
여기서 중요한건,
compile files('libs/YouTubeAndroidPlayerApi.jar')
이게 없으면 안된다.
이렇게 하면, Youtube API을 추가 할 수 있게 된다.
- 검색 일자 : 2015-10-20 [본문으로]