본문 바로가기
안드로이드

안드로이드에서 구글 드라이브와 연동시 발생하는 오류 해결

by 호군 2014. 3. 7.
반응형

지금으로부터 약 6개월? 정도.. 그러니 2013년 7~8월쯤 이였을 겁니다. 전에 안드로이드 디바이스에서 파일을 구글 드라이브와 연동하는 프로젝트를 진행했었습니다. 구글에서 제공하는 Sample 코드들이 있어서 연동이 어렵지는 않았지요. 대신 디렉토리 구조를 그대로 유지해야해서 경로에 대한 작업을 조금 하게 됐습니다. 많은 상황을 고려하지 않았지만 연동은 어느정도 동작하게 됐습니다. 문제는 2개월 정도 전에 테스트를 해보니 구글 드라이브에 인증을 실패하더군요. 로그는 아래와 같습니다.


02-27 18:23:43.466: E/AndroidRuntime(25441): FATAL EXCEPTION: Handler

02-27 18:23:43.466: E/AndroidRuntime(25441): java.lang.VerifyError: com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAccountCredential$RequestHandler

02-27 18:23:43.466: E/AndroidRuntime(25441): at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.initialize(GoogleAccountCredential.java:144)

02-27 18:23:43.466: E/AndroidRuntime(25441): at com.google.api.client.http.HttpRequestFactory.buildRequest(HttpRequestFactory.java:93)

02-27 18:23:43.466: E/AndroidRuntime(25441): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequest(AbstractGoogleClientRequest.java:291)

02-27 18:23:43.466: E/AndroidRuntime(25441): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)

02-27 18:23:43.466: E/AndroidRuntime(25441): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)

02-27 18:23:43.466: E/AndroidRuntime(25441): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)

02-27 18:23:43.466: E/AndroidRuntime(25441): at com.birdland.neodiary.drive.google.GoogleDriveClient$GoogleDriveCore.about(GoogleDriveClient.java:1060)

02-27 18:23:43.466: E/AndroidRuntime(25441): at com.birdland.neodiary.drive.google.GoogleDriveClient$GoogleDriveCore.access$0(GoogleDriveClient.java:1058)

02-27 18:23:43.466: E/AndroidRuntime(25441): at com.birdland.neodiary.drive.google.GoogleDriveClient.login(GoogleDriveClient.java:132)

02-27 18:23:43.466: E/AndroidRuntime(25441): at com.birdland.neodiary.drive.DriveService$DriveHandler.handleMessage(DriveService.java:394)

02-27 18:23:43.466: E/AndroidRuntime(25441): at android.os.Handler.dispatchMessage(Handler.java:99)

02-27 18:23:43.466: E/AndroidRuntime(25441): at android.os.Looper.loop(Looper.java:137)

02-27 18:23:43.466: E/AndroidRuntime(25441): at android.os.HandlerThread.run(HandlerThread.java:61)


문제는 동작하던 코드들이 몇 개월이 지났다고 동작하지 않는 사실이였죠. 오류를 발생하는 메소드들을 바꿔가면서 계속 테스트를 해봤습니다. 그리고 희망이 되는 다른 로그를 얻었습니다.


02-28 10:59:37.588: E/AndroidRuntime(13605): FATAL EXCEPTION: Handler

02-28 10:59:37.588: E/AndroidRuntime(13605): java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.google.android.gms.common.GooglePlayServicesUtil.m(Unknown Source)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.google.android.gms.auth.GoogleAuthUtil.m(Unknown Source)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.getToken(GoogleAccountCredential.java:255)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:279)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:858)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.birdland.neodiary.drive.google.GoogleDriveClient$GoogleDriveCore.about(GoogleDriveClient.java:1060)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.birdland.neodiary.drive.google.GoogleDriveClient$GoogleDriveCore.access$3(GoogleDriveClient.java:1058)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.birdland.neodiary.drive.google.GoogleDriveClient.fetchAllFiles(GoogleDriveClient.java:645)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.birdland.neodiary.drive.google.GoogleDriveClient.syncImpl(GoogleDriveClient.java:474)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.birdland.neodiary.drive.google.GoogleDriveClient.sync(GoogleDriveClient.java:455)

02-28 10:59:37.588: E/AndroidRuntime(13605): at com.birdland.neodiary.drive.DriveService$DriveHandler.handleMessage(DriveService.java:400)

02-28 10:59:37.588: E/AndroidRuntime(13605): at android.os.Handler.dispatchMessage(Handler.java:99)

02-28 10:59:37.588: E/AndroidRuntime(13605): at android.os.Looper.loop(Looper.java:137)

02-28 10:59:37.588: E/AndroidRuntime(13605): at android.os.HandlerThread.run(HandlerThread.java:61)


로그대로 <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> 을 AndroidManifest.xml에 추가했습니다. 물론 google-pla-service_lib 프로젝트를 라이브러리로 추가한 상태입니다.


처음부터 이렇게 알려줬으면 고생하지 않았을 것을... 왜 처음부터 해결책도 알 수 없는 로그를 보여줬는지 모르겠네요.

참고로 제가 사용한 안드로이드 SDK는 2013년10월30일 버전이였습니다.


반응형