我最近已升级到Mavericks操作系统,现在尝试运行时看到错误:
$ phonegap build android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] compiling Android...
[error] An error occurred while building the android project.Error executing "ant debug -f "/usr/vhosts/project/platforms/android/build.xml"":
BUILD FAILED
/Applications/android-developer-tools/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/Applications/android-developer-tools/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.
Total time: 7 seconds
我看过build.xml中的这些行:
<target name="-compile" depends="-pre-build, -build-setup, -code-gen, -pre-compile">
<!-- line 720 --> <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
<!-- merge the project's own classpath and the tested project's classpath -->
<path id="project.javac.classpath">
<path refid="project.all.jars.path" />
<path refid="tested.project.classpath" />
<path path="${java.compiler.classpath}" />
</path>
<javac encoding="${java.encoding}"
source="${java.source}" target="${java.target}"
debug="true" extdirs="" includeantruntime="false"
destdir="${out.classes.absolute.dir}"
bootclasspathref="project.target.class.path"
verbose="${verbose}"
classpathref="project.javac.classpath"
<!-- line 734 --> fork="${need.javac.fork}">
<src path="${source.absolute.dir}" />
<src path="${gen.absolute.dir}" />
<compilerarg line="${java.compilerargs}" />
</javac>
<!-- continue... -->
我还尝试运行
$ ant debug
,该错误返回如下所示的错误负载:-compile:
[javac] Compiling 21 source files to /usr/vhosts/project/platforms/android/bin/classes
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:6: cannot find symbol
[javac] symbol : class AirshipConfigOptions
[javac] location: package com.urbanairship
[javac] import com.urbanairship.AirshipConfigOptions;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:7: cannot find symbol
[javac] symbol : class Autopilot
[javac] location: package com.urbanairship
[javac] import com.urbanairship.Autopilot;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:8: cannot find symbol
[javac] symbol : class Logger
[javac] location: package com.urbanairship
[javac] import com.urbanairship.Logger;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:9: cannot find symbol
[javac] symbol : class UAirship
[javac] location: package com.urbanairship
[javac] import com.urbanairship.UAirship;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:10: package com.urbanairship.push does not exist
[javac] import com.urbanairship.push.PushManager;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:15: cannot find symbol
[javac] symbol: class Autopilot
[javac] public class PushAutopilot extends Autopilot {
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:41: cannot find symbol
[javac] symbol : class AirshipConfigOptions
[javac] location: class com.urbanairship.phonegap.PushAutopilot
[javac] private AirshipConfigOptions getAirshipConfig(Application application, AirshipOptions configOptions) {
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:5: cannot find symbol
[javac] symbol : class Autopilot
[javac] location: package com.urbanairship
[javac] import com.urbanairship.Autopilot;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:6: cannot find symbol
[javac] symbol : class Logger
[javac] location: package com.urbanairship
[javac] import com.urbanairship.Logger;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:7: cannot find symbol
[javac] symbol : class UAirship
[javac] location: package com.urbanairship
[javac] import com.urbanairship.UAirship;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:8: package com.urbanairship.location does not exist
[javac] import com.urbanairship.location.LocationPreferences;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:9: package com.urbanairship.location does not exist
[javac] import com.urbanairship.location.UALocationManager;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:10: package com.urbanairship.push does not exist
[javac] import com.urbanairship.push.PushManager;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:11: package com.urbanairship.push does not exist
[javac] import com.urbanairship.push.PushPreferences;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:12: package com.urbanairship.util does not exist
[javac] import com.urbanairship.util.ServiceNotBoundException;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:48: cannot find symbol
[javac] symbol : class PushPreferences
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] private PushPreferences pushPrefs;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:49: cannot find symbol
[javac] symbol : class LocationPreferences
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] private LocationPreferences locationPrefs;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushReceiver.java:7: cannot find symbol
[javac] symbol : class Logger
[javac] location: package com.urbanairship
[javac] import com.urbanairship.Logger;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushReceiver.java:8: cannot find symbol
[javac] symbol : class UAirship
[javac] location: package com.urbanairship
[javac] import com.urbanairship.UAirship;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushReceiver.java:9: package com.urbanairship.push does not exist
[javac] import com.urbanairship.push.PushManager;
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:30: cannot find symbol
[javac] symbol : variable UAirship
[javac] location: class com.urbanairship.phonegap.PushAutopilot
[javac] UAirship.takeOff(application, getAirshipConfig(application, configOptions));
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:32: cannot find symbol
[javac] symbol : variable PushManager
[javac] location: class com.urbanairship.phonegap.PushAutopilot
[javac] PushManager.shared().setIntentReceiver(PushReceiver.class);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:36: cannot find symbol
[javac] symbol : variable UAirship
[javac] location: class com.urbanairship.phonegap.PushAutopilot
[javac] if (UAirship.shared().getAirshipConfigOptions().pushServiceEnabled && enablePushOnLaunch) {
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:37: cannot find symbol
[javac] symbol : variable PushManager
[javac] location: class com.urbanairship.phonegap.PushAutopilot
[javac] PushManager.enablePush();
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:25: method does not override or implement a method from a supertype
[javac] @Override
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:43: cannot find symbol
[javac] symbol : class AirshipConfigOptions
[javac] location: class com.urbanairship.phonegap.PushAutopilot
[javac] AirshipConfigOptions options = AirshipConfigOptions.loadDefaultOptions(application);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:43: cannot find symbol
[javac] symbol : variable AirshipConfigOptions
[javac] location: class com.urbanairship.phonegap.PushAutopilot
[javac] AirshipConfigOptions options = AirshipConfigOptions.loadDefaultOptions(application);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:97: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushAutopilot.AirshipOptions
[javac] Logger.verbose("Found " + name + " in config.xml with value: " + value);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushAutopilot.java:105: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushAutopilot.AirshipOptions
[javac] Logger.error("Error parsing config file", e);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:60: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.info("Initializing PushNotificationPlugin");
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:61: cannot find symbol
[javac] symbol : variable Autopilot
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Autopilot.automaticTakeOff(cordova.getActivity().getApplication());
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:62: cannot find symbol
[javac] symbol : variable PushManager
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] pushPrefs = PushManager.shared().getPreferences();
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:63: cannot find symbol
[javac] symbol : variable UALocationManager
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] locationPrefs = UALocationManager.shared().getPreferences();
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:73: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.error("Error constructing notification object", e);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:99: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.error("Error in raiseRegistration", e);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:110: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.info("Sending event " + event + ": " + data);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:119: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.debug("Invalid action: " + action);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:127: cannot find symbol
[javac] symbol: variable Logger
[javac] Logger.debug("Plugin Execute: " + action);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:131: cannot find symbol
[javac] symbol: variable Logger
[javac] Logger.error(e);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:143: cannot find symbol
[javac] symbol : variable PushManager
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] PushManager.enablePush();
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:150: cannot find symbol
[javac] symbol : variable PushManager
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] PushManager.disablePush();
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:157: cannot find symbol
[javac] symbol : variable UALocationManager
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] UALocationManager.enableLocation();
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:164: cannot find symbol
[javac] symbol : variable UALocationManager
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] UALocationManager.disableLocation();
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:171: cannot find symbol
[javac] symbol : variable UALocationManager
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] UALocationManager.enableBackgroundLocation();
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:178: cannot find symbol
[javac] symbol : variable UALocationManager
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] UALocationManager.disableBackgroundLocation();
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:239: cannot find symbol
[javac] symbol : variable PushManager
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] String pushID = PushManager.shared().getAPID();
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:276: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.debug("Returning quiet time");
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:288: cannot find symbol
[javac] symbol : variable PushManager
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Set<String> tags = PushManager.shared().getTags();
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:293: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.debug("Returning tags");
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:296: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.error("Error building tags JSON", e);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:303: cannot find symbol
[javac] symbol : variable PushManager
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] String alias = PushManager.shared().getAlias();
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:316: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.debug("Settings alias: " + alias);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:317: cannot find symbol
[javac] symbol : variable PushManager
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] PushManager.shared().setAlias(alias);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:321: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.error("Error reading alias in callback", e);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:338: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.debug("Settings tags: " + tagSet);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:339: cannot find symbol
[javac] symbol : variable PushManager
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] PushManager.shared().setTags(tagSet);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:343: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.error("Error reading tags JSON", e);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:356: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.debug("Settings Sound: " + soundPreference);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:359: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.error("Error reading soundEnabled in callback", e);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:372: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.debug("Settings Vibrate: " + vibrationPreference);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:375: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.error("Error reading vibrateEnabled in callback", e);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:388: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.debug("Settings QuietTime: " + quietPreference);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:391: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.error("Error reading quietTimeEnabled in callback", e);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:414: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.debug("Settings QuietTime. Start: " + start.getTime() + ", End: " + end.getTime());
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:418: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.error("Error reading quietTime JSON", e);
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:429: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.debug("LOGGING LOCATION");
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:430: cannot find symbol
[javac] symbol : variable UALocationManager
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] UALocationManager.shared().recordCurrentLocation();
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:431: cannot find symbol
[javac] symbol : class ServiceNotBoundException
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] } catch (ServiceNotBoundException e) {
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:432: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushNotificationPlugin
[javac] Logger.debug("Location not bound, binding now");
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushNotificationPlugin.java:433: cannot find symbol
... removed for brevity ...
[javac] symbol : variable PushManager
[javac] location: class com.urbanairship.phonegap.PushReceiver
[javac] + intent.getStringExtra(PushManager.EXTRA_APID)
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushReceiver.java:74: cannot find symbol
[javac] symbol : variable PushManager
[javac] location: class com.urbanairship.phonegap.PushReceiver
[javac] + intent.getBooleanExtra(PushManager.EXTRA_REGISTRATION_VALID, false));
[javac] ^
[javac] /usr/vhosts/project/platforms/android/src/com/urbanairship/phonegap/PushReceiver.java:71: cannot find symbol
[javac] symbol : variable Logger
[javac] location: class com.urbanairship.phonegap.PushReceiver
[javac] Logger.info("Registration complete. APID:"
[javac] ^
[javac] Note: /usr/vhosts/project/platforms/android/src/com/clinique/byinvitation/Clinique.java uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 93 errors
BUILD FAILED
/Applications/android-developer-tools/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/Applications/android-developer-tools/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.
Total time: 2 seconds
最佳答案
全部用一行进行排序:
$ phonegap platform update android
我认为出现此错误的原因是因为我最近将Mac升级到了Mavericks OS。
关于android - 在PhoneGap上编译Android,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21730820/