0

FacebookとAndroidを統合しようとしています。https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/の手順に従いました

私のアプリはエミュレーターにインストールされていますが、アプリを開こうとすると、「残念ながら app_name が動作を停止しました」というエラー メッセージが表示されます。

コードにエラーはありませんが、次のように実行時エラーが発生します

08-13 17:50:32.655: W/dalvikvm(1553): VFY: unable to find class referenced in signature         (Landroid/support/v4/app/Fragment;)

08-13 17:50:32.655: W/dalvikvm(1553): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)    
08-13 17:50:32.666: I/dalvikvm(1553): Could not find method android.support.v4.content.LocalBroadcastManager.getInstance, referenced from method com.facebook.Session.postActiveSessionAction    
08-13 17:50:32.666: W/dalvikvm(1553): VFY: unable to resolve static method 187: Landroid/support/v4/content/LocalBroadcastManager;.getInstance (Landroid/content/Context;)Landroid/support/v4/content/LocalBroadcastManager;       
08-13 17:50:32.666: D/dalvikvm(1553): VFY: replacing opcode 0x71 at 0x0009        
08-13 17:50:32.867: D/AndroidRuntime(1553): Shutting down VM        
08-13 17:50:32.867: W/dalvikvm(1553): threadid=1: thread exiting with uncaught exception (group=0x40a13300)        
08-13 17:50:32.876: E/AndroidRuntime(1553): FATAL EXCEPTION: main        
08-13 17:50:32.876: E/AndroidRuntime(1553): java.lang.NoClassDefFoundError:         android.support.v4.content.LocalBroadcastManager    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at com.facebook.Session.postActiveSessionAction(Session.java:1215)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at com.facebook.Session.setActiveSession(Session.java:765)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at com.facebook.Session.openActiveSession(Session.java:865)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at com.facebook.Session.openActiveSession(Session.java:805)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at com.example.projectwin.MainActivity.onCreate(MainActivity.java:19)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at android.app.Activity.performCreate(Activity.java:5008)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at android.app.ActivityThread.access$600(ActivityThread.java:130)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at android.os.Handler.dispatchMessage(Handler.java:99)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at android.os.Looper.loop(Looper.java:137)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at android.app.ActivityThread.main(ActivityThread.java:4745)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at java.lang.reflect.Method.invokeNative(Native Method)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at java.lang.reflect.Method.invoke(Method.java:511)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)    
08-13 17:50:32.876: E/AndroidRuntime(1553):     at dalvik.system.NativeStart.main(Native Method)    

MainActivity.java は

package com.example.projectwin;    


import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.widget.TextView;
import com.facebook.*;
import com.facebook.model.*;

public class MainActivity extends Activity {

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // start Facebook Login
    Session.openActiveSession(this, true, new Session.StatusCallback() {

      // callback when session changes state
      @Override
      public void call(Session session, SessionState state, Exception exception) {
        if (session.isOpened()) {

          // make request to the /me API
          Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {

            // callback after Graph API response with user object
            @Override
            public void onCompleted(GraphUser user, Response response) {
              if (user != null) {
                TextView welcome = (TextView) findViewById(R.id.welcome);
                welcome.setText("Hello " + user.getName() + "!");
              }
            }
          });
        }
      }
    });
  }

  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
  }

}

この問題の解決策を待っています...

4

2 に答える 2