https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/にあるチュートリアルに従っていました
セクション 6 で説明されているように、Facebook ログインで Android プロジェクトを作成しようとすると、次のようなエラーが表示されLogCat
ます。
08-09 15:48:56.556: I/dalvikvm(378): Could not find method com.facebook.Session.getActiveSession, referenced from method com.example.myfirstandroidapplication.MainActivity.onActivityResult
08-09 15:48:56.576: W/dalvikvm(378): VFY: unable to resolve static method 27: Lcom/facebook/Session;.getActiveSession ()Lcom/facebook/Session;
08-09 15:48:56.576: D/dalvikvm(378): VFY: replacing opcode 0x71 at 0x0003
08-09 15:48:56.576: D/dalvikvm(378): VFY: dead code 0x0006-000a in Lcom/example/myfirstandroidapplication/MainActivity;.onActivityResult (IILandroid/content/Intent;)V
08-09 15:48:56.586: I/dalvikvm(378): Failed resolving Lcom/example/myfirstandroidapplication/MainActivity$1; interface 25 'Lcom/facebook/Session$StatusCallback;'
08-09 15:48:56.586: W/dalvikvm(378): Link of class 'Lcom/example/myfirstandroidapplication/MainActivity$1;' failed
08-09 15:48:56.586: E/dalvikvm(378): Could not find class 'com.example.myfirstandroidapplication.MainActivity$1', referenced from method com.example.myfirstandroidapplication.MainActivity.onCreate
08-09 15:48:56.586: W/dalvikvm(378): VFY: unable to resolve new-instance 10 (Lcom/example/myfirstandroidapplication/MainActivity$1;) in Lcom/example/myfirstandroidapplication/MainActivity;
08-09 15:48:56.586: D/dalvikvm(378): VFY: replacing opcode 0x22 at 0x0009
08-09 15:48:56.636: D/dalvikvm(378): VFY: dead code 0x000b-0010 in Lcom/example/myfirstandroidapplication/MainActivity;.onCreate (Landroid/os/Bundle;)V
08-09 15:48:56.717: D/AndroidRuntime(378): Shutting down VM
08-09 15:48:56.717: W/dalvikvm(378): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
08-09 15:48:56.736: E/AndroidRuntime(378): FATAL EXCEPTION: main
08-09 15:48:56.736: E/AndroidRuntime(378): java.lang.NoClassDefFoundError: com.example.myfirstandroidapplication.MainActivity$1
08-09 15:48:56.736: E/AndroidRuntime(378): at com.example.myfirstandroidapplication.MainActivity.onCreate(MainActivity.java:28)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.os.Handler.dispatchMessage(Handler.java:99)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.os.Looper.loop(Looper.java:123)
08-09 15:48:56.736: E/AndroidRuntime(378): at android.app.ActivityThread.main(ActivityThread.java:4627)
08-09 15:48:56.736: E/AndroidRuntime(378): at java.lang.reflect.Method.invokeNative(Native Method)
08-09 15:48:56.736: E/AndroidRuntime(378): at java.lang.reflect.Method.invoke(Method.java:521)
08-09 15:48:56.736: E/AndroidRuntime(378): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-09 15:48:56.736: E/AndroidRuntime(378): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-09 15:48:56.736: E/AndroidRuntime(378): at dalvik.system.NativeStart.main(Native Method)
08-09 16:22:11.456: I/dalvikvm(402): Could not find method com.facebook.Session.getActiveSession, referenced from method com.example.myfirstandroidapplication.MainActivity.onActivityResult
08-09 16:22:11.456: W/dalvikvm(402): VFY: unable to resolve static method 27: Lcom/facebook/Session;.getActiveSession ()Lcom/facebook/Session;
08-09 16:22:11.466: D/dalvikvm(402): VFY: replacing opcode 0x71 at 0x0003
08-09 16:22:11.466: D/dalvikvm(402): VFY: dead code 0x0006-000a in Lcom/example/myfirstandroidapplication/MainActivity;.onActivityResult (IILandroid/content/Intent;)V
08-09 16:22:11.476: I/dalvikvm(402): Failed resolving Lcom/example/myfirstandroidapplication/MainActivity$1; interface 25 'Lcom/facebook/Session$StatusCallback;'
08-09 16:22:11.476: W/dalvikvm(402): Link of class 'Lcom/example/myfirstandroidapplication/MainActivity$1;' failed
08-09 16:22:11.507: E/dalvikvm(402): Could not find class 'com.example.myfirstandroidapplication.MainActivity$1', referenced from method com.example.myfirstandroidapplication.MainActivity.onCreate
08-09 16:22:11.507: W/dalvikvm(402): VFY: unable to resolve new-instance 10 (Lcom/example/myfirstandroidapplication/MainActivity$1;) in Lcom/example/myfirstandroidapplication/MainActivity;
08-09 16:22:11.507: D/dalvikvm(402): VFY: replacing opcode 0x22 at 0x0009
08-09 16:22:11.507: D/dalvikvm(402): VFY: dead code 0x000b-0010 in Lcom/example/myfirstandroidapplication/MainActivity;.onCreate (Landroid/os/Bundle;)V
08-09 16:22:11.696: D/AndroidRuntime(402): Shutting down VM
08-09 16:22:11.706: W/dalvikvm(402): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
08-09 16:22:11.716: E/AndroidRuntime(402): FATAL EXCEPTION: main
08-09 16:22:11.716: E/AndroidRuntime(402): java.lang.NoClassDefFoundError: com.example.myfirstandroidapplication.MainActivity$1
08-09 16:22:11.716: E/AndroidRuntime(402): at com.example.myfirstandroidapplication.MainActivity.onCreate(MainActivity.java:28)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.os.Handler.dispatchMessage(Handler.java:99)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.os.Looper.loop(Looper.java:123)
08-09 16:22:11.716: E/AndroidRuntime(402): at android.app.ActivityThread.main(ActivityThread.java:4627)
08-09 16:22:11.716: E/AndroidRuntime(402): at java.lang.reflect.Method.invokeNative(Native Method)
08-09 16:22:11.716: E/AndroidRuntime(402): at java.lang.reflect.Method.invoke(Method.java:521)
08-09 16:22:11.716: E/AndroidRuntime(402): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-09 16:22:11.716: E/AndroidRuntime(402): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-09 16:22:11.716: E/AndroidRuntime(402): at dalvik.system.NativeStart.main(Native Method)
また、ここで考えられるすべての検索を試み、ライブラリの依存関係を解決しようとしましたが、それでもこのエラーから抜け出せません。
解決策を提案するのに役立つ場合は、facebook SDK 参照エラーのスクリーンショットも添付します。1
この問題の解決策が別のスレッドにある場合は、そのリンクに誘導してください。