App Crashes when calling FirebaseInstanceId.getInstance().getToken())
<p>In my <code>MainActivity</code> class, my app crashes when trying to call <code>FirebaseMessaging.getInstance().subscribeToTopic("global");</code> and   <code>Log.i(TAG, "InstanceID token: " + FirebaseInstanceId.getInstance().getToken());</code> also trying the console in Firebase i cannot receive any notification. </p>

<p>Here is my code</p>

<pre><code>public class MainActivity extends Activity {

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

checkPlayServices(); 

FirebaseMessaging.getInstance().subscribeToTopic("global");
Log.i(TAG, "InstanceID token: " + FirebaseInstanceId.getInstance().getToken());

}
}
</code></pre>

<p>Also i wanted to know is it important to subscribe on topics? </p>

<p>Thank you.</p>