println需要Facebook SDK的消息

时间:2013-08-15 14:14:04

标签: android facebook-sdk-3.0

将我的应用程序与Facebook SDK集成以衡量Facebook移动广告结果后,一些用户收到此错误:

java.lang.NullPointerException: println needs a message
at android.util.Log.println_native(Native Method)
at android.util.Log.d(Log.java:138)
at com.facebook.internal.Utility.logd(Utility.java:287)
at com.facebook.Settings.publishInstallAndWait(Settings.java:291)
at com.facebook.Settings$2.run(Settings.java:218)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:864)

以下是我的活动中关于Facebook SDK的代码段:

import com.facebook.Settings;
import com.facebook.*;

public class MainActivity extends Activity {

public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

// You need to add this code to launch activity.java for Facebook integration:
    Settings.publishInstallAsync(getApplicationContext(), getString(R.string.app_id));

    ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    android.net.NetworkInfo wifi = cm
            .getNetworkInfo(ConnectivityManager.TYPE_WIFI);
    android.net.NetworkInfo datac = cm
            .getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
    if ((wifi != null & datac != null)
            && (wifi.isConnected() | datac.isConnected())) {        
        this.finish();
        Intent intent = new Intent(this, MainOnlineActivity.class);
        this.startActivity(intent);
    }
    else {
        this.finish();
        Intent intent = new Intent(this, MainOfflineActivity.class);
        this.startActivity(intent);
    }

}
} 

请帮我解决。

1 个答案:

答案 0 :(得分:0)

Log消息中传递null方法时,会出现您看到的错误。看起来它是带有Facebook SDK的known issue,并且自版本3.0.1起已修复。