每当我尝试从文档中使用构建 GCM 演示服务器时ant
,都会出现 17 个编译错误。似乎缺少一些 GCM 库。我该如何解决这些问题?
Errors:
Buildfile: build.xml
init:
compile:
[javac] Compiling 7 source files to /root/gcm/samples/gcm-demo-server/build/classes
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:18: package com.google.android.gcm.server does not exist
[javac] import com.google.android.gcm.server.Constants;
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:19: package com.google.android.gcm.server does not exist
[javac] import com.google.android.gcm.server.Message;
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:20: package com.google.android.gcm.server does not exist
[javac] import com.google.android.gcm.server.MulticastResult;
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:21: package com.google.android.gcm.server does not exist
[javac] import com.google.android.gcm.server.Result;
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:22: package com.google.android.gcm.server does not exist
[javac] import com.google.android.gcm.server.Sender;
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:46: cannot find symbol
[javac] symbol : class Sender
[javac] location: class com.google.android.gcm.demo.server.SendAllMessagesServlet
[javac] private Sender sender;
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:59: cannot find symbol
[javac] symbol : class Sender
[javac] location: class com.google.android.gcm.demo.server.SendAllMessagesServlet
[javac] protected Sender newSender(ServletConfig config) {
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:62: cannot find symbol
[javac] symbol : class Sender
[javac] location: class com.google.android.gcm.demo.server.SendAllMessagesServlet
[javac] return new Sender(key);
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:81: cannot find symbol
[javac] symbol : class Message
[javac] location: class com.google.android.gcm.demo.server.SendAllMessagesServlet
[javac] Message message = new Message.Builder().build();
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:81: package Message does not exist
[javac] Message message = new Message.Builder().build();
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:82: cannot find symbol
[javac] symbol : class Result
[javac] location: class com.google.android.gcm.demo.server.SendAllMessagesServlet
[javac] Result result = sender.send(message, registrationId, 5);
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:115: cannot find symbol
[javac] symbol: class Message
[javac] Message message = new Message.Builder().build();
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:115: package Message does not exist
[javac] Message message = new Message.Builder().build();
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:116: cannot find symbol
[javac] symbol: class MulticastResult
[javac] MulticastResult multicastResult;
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:123: cannot find symbol
[javac] symbol: class Result
[javac] List<Result> results = multicastResult.getResults();
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:127: cannot find symbol
[javac] symbol: class Result
[javac] Result result = results.get(i);
[javac] ^
[javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:140: cannot find symbol
[javac] symbol: variable Constants
[javac] if (error.equals(Constants.ERROR_NOT_REGISTERED)) {
[javac] ^
[javac] 17 errors
BUILD FAILED