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

}
} 

请帮我修复它。

4

1 回答 1

0

您看到的错误是在消息Log中传递方法时发生的。null看起来这是 Facebook SDK 的一个已知问题,并已在 3.0.1 版中修复。

于 2013-08-15T14:56:09.967 回答