包android.support.v4.app不存在(Android 17)

时间:2014-01-15 15:17:15

标签: android android-4.2-jelly-bean cordova-3

我正在尝试为Android编译我的cordova应用程序,但是我收到了这个错误:

[javac] Compiling 104 source files to /Volumes/Work/workspace/android/poc/CordovaLib/bin/classes
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/CordovaGCMBroadcastReceiver.java:5: package com.google.android.gcm does not exist
[javac] import com.google.android.gcm.GCMBroadcastReceiver;
[javac]                              ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/CordovaGCMBroadcastReceiver.java:6: package com.google.android.gcm does not exist
[javac] import static com.google.android.gcm.GCMConstants.DEFAULT_INTENT_SERVICE_CLASS_NAME;
[javac]                                     ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/CordovaGCMBroadcastReceiver.java:6: static import only from classes and interfaces
[javac] import static com.google.android.gcm.GCMConstants.DEFAULT_INTENT_SERVICE_CLASS_NAME;
[javac] ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/CordovaGCMBroadcastReceiver.java:12: cannot find symbol
[javac] symbol: class GCMBroadcastReceiver
[javac] public class CordovaGCMBroadcastReceiver extends GCMBroadcastReceiver {
[javac]                                                  ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/GCMIntentService.java:5: package com.google.android.gcm does not exist
[javac] import com.google.android.gcm.GCMBaseIntentService;
[javac]                              ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/GCMIntentService.java:18: package android.support.v4.app does not exist
[javac] import android.support.v4.app.NotificationCompat;
[javac]                              ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/GCMIntentService.java:22: cannot find symbol
[javac] symbol: class GCMBaseIntentService
[javac] public class GCMIntentService extends GCMBaseIntentService {
[javac]                                       ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/PushPlugin.java:18: package com.google.android.gcm does not exist
[javac] import com.google.android.gcm.*;
[javac] ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/CordovaGCMBroadcastReceiver.java:16: cannot find symbol
[javac] symbol  : variable DEFAULT_INTENT_SERVICE_CLASS_NAME
[javac] location: class com.plugin.gcm.CordovaGCMBroadcastReceiver
[javac]         return "com.plugin.gcm" + DEFAULT_INTENT_SERVICE_CLASS_NAME;
[javac]                                   ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/CordovaGCMBroadcastReceiver.java:14: method does not override or implement a method from a supertype
[javac]     @Override
[javac]     ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/GCMIntentService.java:31: method does not override or implement a method from a supertype
[javac]     @Override
[javac]     ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/GCMIntentService.java:57: method does not override or implement a method from a supertype
[javac]     @Override
[javac]     ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/GCMIntentService.java:62: method does not override or implement a method from a supertype
[javac]     @Override
[javac]     ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/GCMIntentService.java:88: cannot find symbol
[javac] symbol  : method getSystemService(java.lang.String)
[javac] location: class com.plugin.gcm.GCMIntentService
[javac]         NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
[javac]                                                                          ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/GCMIntentService.java:89: getAppName(android.content.Context) in com.plugin.gcm.GCMIntentService cannot be applied to (com.plugin.gcm.GCMIntentService)
[javac]         String appName = getAppName(this);
[javac]                          ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/GCMIntentService.java:91: cannot find symbol
[javac] symbol  : constructor Intent(com.plugin.gcm.GCMIntentService,java.lang.Class<com.plugin.gcm.PushHandlerActivity>)
[javac] location: class android.content.Intent
[javac]         Intent notificationIntent = new Intent(this, PushHandlerActivity.class);
[javac]                                     ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/GCMIntentService.java:95: cannot find symbol
[javac] symbol  : method getActivity(com.plugin.gcm.GCMIntentService,int,android.content.Intent,int)
[javac] location: class android.app.PendingIntent
[javac]         PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
[javac]                                                    ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/GCMIntentService.java:97: package NotificationCompat does not exist
[javac]         NotificationCompat.Builder mBuilder =
[javac]                           ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/GCMIntentService.java:98: package NotificationCompat does not exist
[javac]             new NotificationCompat.Builder(context)
[javac]                                   ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/GCMIntentService.java:137: method does not override or implement a method from a supertype
[javac]     @Override
[javac]     ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/PushPlugin.java:67: cannot find symbol
[javac] symbol  : variable GCMRegistrar
[javac] location: class com.plugin.gcm.PushPlugin
[javac]                 GCMRegistrar.register(getApplicationContext(), gSenderID);
[javac]                 ^
[javac] /Volumes/Work/workspace/android/poc/CordovaLib/src/com/plugin/gcm/PushPlugin.java:84: cannot find symbol
[javac] symbol  : variable GCMRegistrar
[javac] location: class com.plugin.gcm.PushPlugin
[javac]             GCMRegistrar.unregister(getApplicationContext());
[javac]             ^
[javac] 22 errors[Error] AndroidPackager::build : Impossible de compiler le projet

我正在针对Android 17(4.2.2)进行编译。文件 android-support-v4.jar 存在于libs目录中。

我只使用命令行来编译我的项目。

关于这个问题的任何想法?

2 个答案:

答案 0 :(得分:5)

我已经想到了这一点:我在CordovaLib \ libs目录中复制了android-support-v13.jar。现在工作正常。

答案 1 :(得分:2)

只需将android-support-v4.jar$ANDROID_HOME/extras/android/support/v4/复制到${project}/platforms/android/libs/,您还必须从gradle脚本${project}/platforms/android/project.propertiesbuild.gradle

中删除相关性