Eclipse で Android 用のシンプルな OAuth クライアントを構築しようとしています。
code.google.com/p/google-api-java-client/wiki/Setupの指示に従いました
zip ファイルをダウンロードしgoogle-api-client-1.6.0-beta.jar
、Eclipse のビルド パスに追加しました。以下に示すように、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)