将我的应用程序与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);
}
}
}
请帮我解决。