How to setup Google Cloud Messaging for Android?

2019-02-03 17:07发布

问题:

I am trying to implement Google Cloud Messaging for Android (GCM) by following the demo

But i am unable to execute some command like $ ant war,$ android update project --name GCMDemo -p . --target android-16.

I am using wamp server and targetting Android 8+

Any help would be highly appreciated

回答1:

If you want to execute $ant war command:

  1. first you need to download and install Apache Ant on your computer.
  2. Then you should configurate your PATH and JAVA_HOME variables like it is described here (into "Installing Apache Ant" section).
  3. And only after that you can execute ant war command into Windows command line (prompt). After ant war command .war file will be created.
  4. then you can deploy and run your .war file on tomcat server for example. (create Java EE project, then download and install tomcat server, configurate paths, and run your project on tomcat server...)