Cordova push notificacion

Al compilar mi proyecto y colocar el plugin de notificaciones fcm me sale este error , me podrian ayudar

Configure project :app
google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default version: 9.0.0 will be used.
please apply google-services plugin at the bottom of the build file.
WARNING: Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’.
It will be removed in version 5.0 of the Android Gradle plugin.
For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

Configure project :CordovaLib
[Cordova] cdvMinSdkVersion is overridden, try it at your own risk.

Task :app:processDebugGoogleServices
Parsing json file: /Users/iss02/Documents/www/is-market/app/appismarket/platforms/android/app/google-services.json

Task :app:compileDebugJavaWithJavac
/Users/iss02/Documents/www/is-market/app/appismarket/platforms/android/app/src/main/java/org/apache/cordova/camera/CameraLauncher.java:42: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
^
/Users/iss02/Documents/www/is-market/app/appismarket/platforms/android/app/src/main/java/org/apache/cordova/camera/FileProvider.java:21: error: package android.support.v4.content does not exist
public class FileProvider extends android.support.v4.content.FileProvider {}
^
/Users/iss02/Documents/www/is-market/app/appismarket/platforms/android/app/src/main/java/com/gae/scaffolder/plugin/FCMPluginActivity.java:11: error: package android.support.v4.content does not exist
import android.support.v4.content.LocalBroadcastManager;
^
/Users/iss02/Documents/www/is-market/app/appismarket/platforms/android/app/src/main/java/com/gae/scaffolder/plugin/MyFirebaseMessagingService.java:9: error: cannot find symbol
import android.support.v4.app.NotificationCompat;
^
symbol: class NotificationCompat
location: package android.support.v4.app
/Users/iss02/Documents/www/is-market/app/appismarket/platforms/android/app/src/main/java/org/apache/cordova/camera/CameraLauncher.java:296: error: cannot find symbol
this.imageUri = FileProvider.getUriForFile(cordova.getActivity(),
^
symbol: method getUriForFile(Activity,String,File)
location: class FileProvider
/Users/iss02/Documents/www/is-market/app/appismarket/platforms/android/app/src/main/java/org/apache/cordova/camera/CameraLauncher.java:823: error: cannot find symbol
Uri tmpFile = FileProvider.getUriForFile(cordova.getActivity(),
^
symbol: method getUriForFile(Activity,String,File)
location: class FileProvider
/Users/iss02/Documents/www/is-market/app/appismarket/platforms/android/app/src/main/java/com/gae/scaffolder/plugin/MyFirebaseMessagingService.java:72: error: package NotificationCompat does not exist
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
^
/Users/iss02/Documents/www/is-market/app/appismarket/platforms/android/app/src/main/java/com/gae/scaffolder/plugin/MyFirebaseMessagingService.java:72: error: package NotificationCompat does not exist
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
8 errors

Task :app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:compileDebugJavaWithJavac’.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See Command-Line Interface

BUILD FAILED in 16s
26 actionable tasks: 21 executed, 5 up-to-date
Command failed with exit code 1: /Users/iss02/Documents/www/is-market/app/appismarket/platforms/android/gradlew cdvBuildDebug -b /Users/iss02/Documents/www/is-market/app/appismarket/platforms/android/build.gradle

Por lo general hay que agregar algo en el config.xml. para que tome el firebase.
Por otro lado el json de firebase tiene que estar en el root de la app.

gracias por contestar, he realizado lo que comentas , coloque en config la ruta de google services y lo coloque en app y me siguen saliendo errores , no se que otra cosa pueda ser

Acá prácticamente te dice los errores que debes de corregir. Al parecer el plugin de firebase en la versión q instalaste no cunciona bien con el plugin de notificaciones.

oh bien gracias por contestar, estoy usando la version de android 9 , entonces tengo que utilizar la 8 ? y otra duda esto no repercute si lo instalo en un android 10 la aplicación ?

Hola Alejandro.

Qué versión de cordova-android estas usando? Qué plugins y qué versiones de los plugins?

Para las notificaciones push, yo utilizo el plugin cordova-plugin-firebasex y siempre ha funcionado correctamente.

hola gracias por responder ,estoy usando la version 9 de android en cordova , los plugins que instale son
cordova-android-play-services-gradle-release
cordova-plugin-androidx-adapter
cordova-plugin-fcm
cordova-plugin-firebasex

Si me pudieras apoyar con los plugin que debo instalar estaria de lujo, Gracias

Utiliza la última versión de cordova-android (9.1) y sólo instala el plugin “cordova-plugin-firebasex” siguiendo los pasos en su documentación oficial. Elimina los otros plugins y asegurate de tener los paquetes del SDK Android actualizados.

2 Likes

Tuve que activar las notificaciones para esa app y al final si funcionó , muchas gracias a todos por el apoyo

1 Like