2013-05-28 3 views
16

Android Studio를 사용해 보겠습니다. 내 프로젝트에서 드라이브 API를 사용하고 싶습니다. eclipse에는 Eclipse 용 Google 플러그인이 있지만 Android Studio는 어떻습니까? 아무도 지금까지 해봤습니까?Android Studio에서 Google API를 가져 오는 방법

+0

난 그냥이 자신을 궁금 해서요. –

+1

@AliAfshar :이 링크는 내가 필요한 것에 매우 가깝습니다. http://stackoverflow.com/questions/15858037/google-play-drive-api-sample-code-in-intellij – bianca

답변

2

은 당신이 SDK 폴더

  • 링크 모듈과 라이브러리에 필요한 API의 항아리에 구조> 글로벌 라이브러리/라이브러리> 링크를 투사 이동
    1. 을 시도 했
  • 1

    나는 Google 운전사를 시도하지 않으며, 그러나 Google usb 부속품 api를 시도했다. 내 경우에는 열기에 MyProject은/MyProject를/build.gradle

    , 의존성에

    compile files("libs/usb.jar") 
    

    은 물론

    을 차단 추가에 MyProject에

    android-studio\sdk\add-ons\addon-google_apis-google-10\libs\usb.jar 
    

    에서 구글 드라이버 libs와 복사/MyProject/libs

    행운을 빈다. 당신.

    3

    Java 클라이언트 라이브러리는 Android도 지원합니다. 여기에서 다운로드 할 수 있습니다 : https://code.google.com/p/google-api-java-client/wiki/APIs#Drive_API

    그런 다음 드라이브 SDK 다운로드의 압축을 풀고 폴더를 프로젝트의 libs 섹션으로 이동하십시오. 예를 들어 :이 시점에서 /사용자/-username-/AndroidStudioProjects/MyProject를/MyProjectActivity/libs와/

    , 당신은 파일을 클릭하여 프로젝트에 라이브러리를 추가 할 수 있습니다 -> 프로젝트 구조, 다음 라이브러리 탭을 클릭, + 기호를 사용하여 프로젝트에 SDK를 추가하십시오.

    현재 자바 용 Google API 클라이언트 라이브러리에 대한 안드로이드 특정 개발 지침을 읽을 수

    : https://code.google.com/p/google-api-java-client/wiki/Android

    +0

    답변입니다! Google api jar 파일을 프로젝트에 복사하지 마십시오! 응용 프로그램에서 sdk를 seperatly 관리하면 sdk를 업데이트하고 jar 파일을 libs 폴더에 복사하지 않고도 새로운 API 수준을 가리킬 수 있습니다. – speedynomads

    4

    내가 같은 상황에 있었고, 여기 Gradle을이 권리를 찾기 위해 어떻게 작동하는지에이 정보를 찾을 수 있었다 의존성 집합 및 필요한 제외. 당신의 build.gradle 파일

    // Replace 'dependencies' in your build.gradle file with the following 
    // or add these to whatever other dependencies you have. 
    
    dependencies { 
        compile 'com.android.support:support-v4:19.0.0' 
        compile 'com.google.android.gms:play-services:4.0.30' 
        compile('com.google.api-client:google-api-client-xml:1.17.0-rc') { 
         exclude group: 'com.google.android.google-play-services' 
        } 
        compile 'com.google.http-client:google-http-client-gson:1.17.0-rc' 
        compile('com.google.api-client:google-api-client-android:1.17.0-rc') { 
         exclude group: 'com.google.android.google-play-services' 
        } 
        compile 'com.google.apis:google-api-services-drive:v2-rev105-1.17.0-rc' 
    } 
    

    가 시간에 계속 변경으로의 종속성에서 필요로 여기 라인은, 내가 가지 변화에 따라 업데이트 계속거야 gist을했습니다.

    Google 드라이브 빠른 시작을 수정하여 기사를 작성하여 Android Studio에서 사용할 수 있도록했습니다. 관심이 있다면 당신은 here

    편집을 찾을 수 있습니다 :이 Gradle을 수입 자바 용 Google 드라이브 API가 아닌 구글 플레이 서비스와 통합 된 Developer Preview Google Drive API를 사용한다.

    +0

    이것들은 구식의 값입니다. 나는 값을 추가했습니다. – Michal

    0

    smokybob의 답변이 효과적 이었지만 몇 가지 실험을 수행했는데 이것도 나를 위해 일했습니다.

    dependencies { 
        compile files ('libs/libGoogleAnalyticsServices.jar') 
        compile ('joda-time:joda-time:2.3') 
        compile ('com.google.code.gson:gson:2.2.4') 
        compile 'com.google.android.gms:play-services:4.1.+' 
    } 
    

    은 내가 joda 시간을 추측하고 있는데 GSON는 드라이브 API와는 아무 상관이 없습니다.

    참고 내가

    gradle dependancies 
    

    내가 SDK 관리자에서 추가의에서

    +--- joda-time:joda-time:2.3 
    +--- com.google.code.gson:gson:2.2.4 
    \--- com.google.android.gms:play-services:4.1.+ -> 4.1.32 
        \--- com.android.support:support-v4:19.0.1 
    
    0

    을받을 수 있나요 때, 나는 구글 서비스, 구글 저장소 및 안드로이드 지원 라이브러리를 재생 다운로드. 그 후, 아래의 종속성을 포함하고 Gradle과 동기화하고 API에 액세스 할 수있었습니다.

    종속성 { filetree (dir : 'libs', include : [ '* .jar']) // Pls. 이 종속성을 사용하려면 SDK 관리자를 통해 Google 리포지토리를 설치하거나 업데이트하십시오. 컴파일 'com.google.android.gms : 플레이 서비스 : 5.0 +.' }

    6

    우는 소리 당신이 Google 드라이브에 대한 마지막 버전을 찾을 수있다 (2014년 12월 28일) :

    //Google Drive API 
    compile 'com.google.android.gms:play-services:6.5.+' 
    compile 'com.google.api-client:google-api-client-xml:1.18.0-rc'   
    compile 'com.google.http-client:google-http-client-gson:1.18.0-rc' 
    compile 'com.google.api-client:google-api-client-android:1.18.0-rc' 
    compile 'com.google.apis:google-api-services-drive:v2-rev155-1.19.0' 
    

    것은 지난 확인하려면 버전 시도는 다음 링크 :

    https://developer.android.com/google/play-services/setup.html

    https://code.google.com/p/google-api-java-client

    https://developers.google.com/api-client-library/java/apis/drive/v2

    http://mvnrepository.com/artifact/com.google.apis/google-api-services-drive

    관련 문제