Eclipse에서 간단한 Android 용 OAuth 클라이언트를 만들려고합니다. Eclipse에서 간단한 Google API Android 앱을 컴파일 할 수 없습니다.
나는 zip 파일 다운로드 code.google.com/p/google-api-java-client/wiki/Setup에서의 지침을 따라 Eclipse에서 내 빌드 경로에 google-api-client-1.6.0-beta.jar
을 추가했다. 아래의 그림과 같이 Referenced Libraries 아래에 13 가지 종속성이 모두 표시됩니다.
코드는 간단합니다. 방금 기본 활동에 다음 변경 사항을 수행했습니다.
public class Testing1Activity extends Activity {
/** Called when the activity is first created. */
final String TAG = getClass().getName();
public static final String CLIENT_ID = "";
public static final String CLIENT_SECRET = "";
public static final String REDIRECT_URI = "";
public static final String SCOPE = "https://www.googleapis.com/auth/latitude.all.best";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Json s = new Json();
String authorizationUrl = new GoogleAuthorizationRequestUrl(CLIENT_ID, REDIRECT_URI, SCOPE)
.build();
}
}
나는이 망할 오류가 계속 발생합니다. :(
W/dalvikvm( 591): Unable to resolve superclass of Lcom/google/api/client/googleapis/auth/oauth2/draft10/GoogleAuthorizationRequestUrl; (18)
W/dalvikvm( 591): Link of class 'Lcom/google/api/client/googleapis/auth/oauth2/draft10/GoogleAuthorizationRequestUrl;' failed
E/dalvikvm( 591): Could not find class 'com.google.api.client.googleapis.auth.oauth2.draft10.GoogleAuthorizationRequestUrl', referenced from method com.rahul.Testing1Activity.onCreate
W/dalvikvm( 591): VFY: unable to resolve new-instance 37 (Lcom/google/api/client/googleapis/auth/oauth2/draft10/GoogleAuthorizationRequestUrl;) in Lcom/rahul/Testing1Activity;
D/dalvikvm( 591): VFY: replacing opcode 0x22 at 0x000d
D/dalvikvm( 591): VFY: dead code 0x000f-001c in Lcom/rahul/Testing1Activity;.onCreate (Landroid/os/Bundle;)V
D/AndroidRuntime( 591): Shutting down VM
W/dalvikvm( 591): threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime( 591): FATAL EXCEPTION: main
E/AndroidRuntime( 591): java.lang.NoClassDefFoundError: com.google.api.client.googleapis.auth.oauth2.draft10.GoogleAuthorizationRequestUrl
E/AndroidRuntime( 591): at com.rahul.Testing1Activity.onCreate(Testing1Activity.java:25)
나는 내 프로젝트를 위해 google-api-java-client 라이브러리를 구현하는 방법을 알아 내려고 노력해 왔으며 귀하의 게시물은 그 자리에있었습니다! 전체 라이브러리의 jar/zip 파일을 추가하는 것만으로는 효과가 없습니다. –