Facebook的麻烦 - java.lang.RuntimeException:无法启动活动ComponentInfo = ANDROID ISSUE

时间:2013-05-14 23:59:05

标签: android facebook sdk

我不知道我在做什么..

我的意思是,但我不像你们那样先进,所以我觉得自己像个菜鸟。

无论如何,从facebook sdk开发者网站复制并粘贴了一些代码用于android。

这是清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fbdps.brcr"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.fbdps.brcr.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <meta-data android:value="@string/app_id"              android:name="com.facebook.sdk.ApplicationId,"/>
    <activity android:label="@string/app_name" android:name="com.facebook.LoginActivity"></activity>
</application>

</manifest>

这是java

  package com.fbdps.brcr;

 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);
 }

}

我无法使应用程序正常工作..请参阅下面的图片..

感谢您的帮助! enter image description here

这是strings.xml

<?xml version="1.0" encoding="utf-8"?>

<string name="app_name">BRCR</string>
<string name="hello_world">Hello world!</string>
<string name="menu_settings">Settings</string>
<string name="app_id">158392974335182</string>

0 个答案:

没有答案