Closed ondergur-bdt closed 4 years ago
Add implementation 'com.google.firebase:firebase-messaging:20.1.0'
to your dependencies in your app build.gradle.
Again, not building. This is build output.
Executing tasks: [:app:assembleDebug] in project /Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/android
> Configure project :capacitor-android
WARNING: API 'variant.getJavaCompiler()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getJavaCompiler(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
WARNING: API 'variantOutput.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getPackageLibrary(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
> Task :app:preBuild UP-TO-DATE
> Task :capacitor-android:preBuild UP-TO-DATE
> Task :capacitor-android:preDebugBuild UP-TO-DATE
> Task :capacitor-android:checkDebugManifest UP-TO-DATE
> Task :capacitor-android:processDebugManifest UP-TO-DATE
> Task :capacitor-cordova-android-plugins:preBuild UP-TO-DATE
> Task :capacitor-cordova-android-plugins:preDebugBuild UP-TO-DATE
> Task :capacitor-cordova-android-plugins:checkDebugManifest UP-TO-DATE
> Task :capacitor-cordova-android-plugins:processDebugManifest UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :capacitor-android:compileDebugAidl NO-SOURCE
> Task :capacitor-cordova-android-plugins:compileDebugAidl NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :capacitor-android:packageDebugRenderscript NO-SOURCE
> Task :capacitor-cordova-android-plugins:packageDebugRenderscript NO-SOURCE
> Task :app:compileDebugRenderscript UP-TO-DATE
> Task :app:checkDebugManifest UP-TO-DATE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:prepareLintJar UP-TO-DATE
> Task :app:processDebugGoogleServices UP-TO-DATE
> Task :app:generateDebugSources UP-TO-DATE
> Task :capacitor-android:compileDebugRenderscript UP-TO-DATE
> Task :capacitor-android:generateDebugBuildConfig UP-TO-DATE
> Task :capacitor-android:generateDebugResValues UP-TO-DATE
> Task :capacitor-android:generateDebugResources UP-TO-DATE
> Task :capacitor-android:packageDebugResources UP-TO-DATE
> Task :capacitor-android:generateDebugRFile UP-TO-DATE
> Task :capacitor-android:prepareLintJar UP-TO-DATE
> Task :capacitor-android:generateDebugSources UP-TO-DATE
> Task :capacitor-android:javaPreCompileDebug UP-TO-DATE
> Task :capacitor-android:compileDebugJavaWithJavac FAILED
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:26: error: package com.google.android.gms.tasks does not exist
import com.google.android.gms.tasks.OnFailureListener;
^
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:27: error: package com.google.android.gms.tasks does not exist
import com.google.android.gms.tasks.OnSuccessListener;
^
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:28: error: package com.google.firebase.iid does not exist
import com.google.firebase.iid.FirebaseInstanceId;
^
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:29: error: package com.google.firebase.iid does not exist
import com.google.firebase.iid.InstanceIdResult;
^
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:30: error: package com.google.firebase.messaging does not exist
import com.google.firebase.messaging.FirebaseMessaging;
^
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:31: error: package com.google.firebase.messaging does not exist
import com.google.firebase.messaging.RemoteMessage;
^
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:52: error: cannot find symbol
public static RemoteMessage lastMessage = null;
^
symbol: class RemoteMessage
location: class PushNotifications
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:267: error: cannot find symbol
public static void sendRemoteMessage(RemoteMessage remoteMessage) {
^
symbol: class RemoteMessage
location: class PushNotifications
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:276: error: cannot find symbol
public void fireNotification(RemoteMessage remoteMessage) {
^
symbol: class RemoteMessage
location: class PushNotifications
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/CapacitorFirebaseMessagingService.java:4: error: package com.google.firebase.messaging does not exist
import com.google.firebase.messaging.FirebaseMessagingService;
^
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/CapacitorFirebaseMessagingService.java:5: error: package com.google.firebase.messaging does not exist
import com.google.firebase.messaging.RemoteMessage;
^
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/CapacitorFirebaseMessagingService.java:7: error: cannot find symbol
public class CapacitorFirebaseMessagingService extends FirebaseMessagingService {
^
symbol: class FirebaseMessagingService
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/CapacitorFirebaseMessagingService.java:16: error: cannot find symbol
public void onMessageReceived(RemoteMessage remoteMessage) {
^
symbol: class RemoteMessage
location: class CapacitorFirebaseMessagingService
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:95: error: cannot find symbol
FirebaseMessaging.getInstance().setAutoInitEnabled(true);
^
symbol: variable FirebaseMessaging
location: class PushNotifications
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:96: error: cannot find symbol
FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(getActivity(), new OnSuccessListener<InstanceIdResult>() {
^
symbol: class OnSuccessListener
location: class PushNotifications
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:96: error: cannot find symbol
FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(getActivity(), new OnSuccessListener<InstanceIdResult>() {
^
symbol: class InstanceIdResult
location: class PushNotifications
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:96: error: cannot find symbol
FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(getActivity(), new OnSuccessListener<InstanceIdResult>() {
^
symbol: variable FirebaseInstanceId
location: class PushNotifications
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:102: error: cannot find symbol
FirebaseInstanceId.getInstance().getInstanceId().addOnFailureListener(new OnFailureListener() {
^
symbol: class OnFailureListener
location: class PushNotifications
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:102: error: cannot find symbol
FirebaseInstanceId.getInstance().getInstanceId().addOnFailureListener(new OnFailureListener() {
^
symbol: variable FirebaseInstanceId
location: class PushNotifications
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java:287: error: package RemoteMessage does not exist
RemoteMessage.Notification notification = remoteMessage.getNotification();
^
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/CapacitorFirebaseMessagingService.java:9: error: method does not override or implement a method from a supertype
@Override
^
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/CapacitorFirebaseMessagingService.java:11: error: cannot find symbol
super.onNewToken(newToken);
^
symbol: variable super
location: class CapacitorFirebaseMessagingService
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/CapacitorFirebaseMessagingService.java:15: error: method does not override or implement a method from a supertype
@Override
^
/Users/suleyman/Desktop/Projects/ionic-android-refresher-bug/IonicAndroidRefresher/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/CapacitorFirebaseMessagingService.java:17: error: cannot find symbol
super.onMessageReceived(remoteMessage);
^
symbol: variable super
location: class CapacitorFirebaseMessagingService
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
24 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':capacitor-android: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 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 3s
18 actionable tasks: 1 executed, 17 up-to-date
I've follow the second tutorial and it's working fine. Might be some connection issue on your computer not being able to download firebase dependencies. Can you provide a sample app?
update the dependency
implementation 'com.google.firebase:firebase-messaging:18.0.0'
to
implementation 'com.google.firebase:firebase-messaging:20.0.0'
in the build.gradle (Module: @capacitor-capacitor-android)
closing as there was no response
Solution not working
class file for android.app.Service not found
Hi. I am developing a multi platform app with Ionic - React using capacitor. ;I was trying to implement push notification feature as documented here and here.
I followed the instructions and add the
google-services.json
file to the android > app directory. After that sync the Gradle then try to bundle the app. But I encounter with these error messages in build output.This is my project build.gradle file:
This is my app build.gradle file: