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

2

6

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 ?

Perigon answered 15/1, 2014 at 15:17 Comment(4)
What IDE are you using? or is it a build from command line?Redmond
I'm building from command linePerigon
in the correct libs directoy? Should be ..../poc/CordovaLib/libs/android-support-v4.jar And what type of commandline build process is that? make, gradle, ant, mvn ?Rozina
I've figured this out: I've copied android-support-v13.jar in CordovaLib\libs directory. It works fine now.Perigon
P
5

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

Perigon answered 15/1, 2014 at 15:40 Comment(2)
Me too, I tried to compile Android SDK android-19/legacy/ApiDemos and got the same error. So I copied android-support-v13.jar from extras/android-support/v13 directory in SDK to libs and it worked!Suavity
Just as a note, in 2017 the jar file will probably have a name such as support-v13-VERSION.jar , with VERSION being something like 19.0.1 or 19.1.0 or the likeVictimize
C
2

Just copy android-support-v4.jar from $ANDROID_HOME/extras/android/support/v4/ to ${project}/platforms/android/libs/ you also have to remove the dependency from gradle script ${project}/platforms/android/project.properties and build.gradle

Cranmer answered 18/9, 2015 at 8:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.