package android.support.v4.app does not exist (Android 17)

ridan picture ridan · Jan 15, 2014 · Viewed 12.6k times · Source

I'm trying to compile my cordova application for Android but I'm getting this error:

[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

I'm compiling against Android 17 (4.2.2). The file android-support-v4.jar exists in libs directory.

I'm using just command lines to compile my projects.

Any ideas about this issue ?

Answer

ridan picture ridan · Jan 15, 2014

I've figured this out: I've copied android-support-v13.jar in CordovaLib\libs directory. It works fine now.