Pushwoosh / pushwoosh-phonegap-plugin

Pushwoosh PhoneGap Build Plugin
Other
109 stars 139 forks source link

Android build fails with cordova-android version 11 and targetSdkVersion >= 31 #376

Closed unekinn closed 1 year ago

unekinn commented 1 year ago

Tested with pushwoosh-cordova-plugin 8.3.6 and cordova-android 11.0.0.

According to Google we have to start targeting sdk version 31 this November

Starting in November 2022, app updates must target API level 31 or above and adjust for behavioral changes in Android 12

Here's the build error:

> Task :app:compileDebugJavaWithJavac FAILED
<app-dir>/platforms/android/app/src/main/java/com/pushwoosh/plugin/pushnotifications/CustomFirebaseMessagingService.java:5: error: package com.google.firebase.messaging does not exist
import com.google.firebase.messaging.FirebaseMessagingService;
                                    ^
<app-dir>/platforms/android/app/src/main/java/com/pushwoosh/plugin/pushnotifications/CustomFirebaseMessagingService.java:6: error: package com.google.firebase.messaging does not exist
import com.google.firebase.messaging.RemoteMessage;
                                    ^
<app-dir>/platforms/android/app/src/main/java/com/pushwoosh/plugin/pushnotifications/CustomFirebaseMessagingService.java:9: error: cannot find symbol
public class CustomFirebaseMessagingService extends FirebaseMessagingService {
                                                    ^
  symbol: class FirebaseMessagingService
<app-dir>/platforms/android/app/src/main/java/com/pushwoosh/plugin/pushnotifications/CustomFirebaseMessagingService.java:11: error: cannot find symbol
    public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
                                           ^
  symbol:   class RemoteMessage
  location: class CustomFirebaseMessagingService
<app-dir>/platforms/android/app/src/main/java/com/pushwoosh/plugin/pushnotifications/CustomFirebaseMessagingService.java:10: error: method does not override or implement a method from a supertype
    @Override
    ^
<app-dir>/platforms/android/app/src/main/java/com/pushwoosh/plugin/pushnotifications/CustomFirebaseMessagingService.java:19: error: method does not override or implement a method from a supertype
    @Override
    ^
<app-dir>/platforms/android/app/src/main/java/com/pushwoosh/plugin/pushnotifications/CustomFirebaseMessagingService.java:21: error: cannot find symbol
        super.onNewToken(s);
        ^
  symbol:   variable super
  location: class CustomFirebaseMessagingService
<app-dir>/platforms/android/app/src/main/java/com/pushwoosh/plugin/pushnotifications/PushNotifications.java:182: error: cannot find symbol
                                        if (result.isSuccess() && result.getData != null) {
                                                                        ^
  symbol:   variable getData
  location: variable result of type Result<RegisterForPushNotificationsResultData,RegisterForPushNotificationsException>
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: <app-dir>/platforms/android/app/src/main/java/org/apache/cordova/file/AssetFilesystem.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
8 errors
Techsorcist commented 1 year ago

Hello @larskinn, judging the trace you provided, I assume your app using a multiple implementations of FirebaseMessagingService. Am I correct? If so, please consider using a router service. More info here: https://docs.pushwoosh.com/platform-docs/pushwoosh-sdk/cross-platform-frameworks/cordova/customizing-cordova-plugin#using-pushwoosh-plugin-with-other-fcm-services

unekinn commented 1 year ago

@Techsorcist

I assume your app using a multiple implementations of FirebaseMessagingService

I don't believe we are. We for sure are not actively using any other messaging service, and the only search result for FirebaseMessagingService in the generated platforms/android folder is in platforms/android/app/src/main/java/com/pushwoosh/plugin/pushnotifications/CustomFirebaseMessagingService.java

We're using the following cordova plugins, and no custom platform-specific code:

cordova-plugin-device
cordova-plugin-geolocation
cordova-plugin-inappbrowser
cordova-plugin-calendar
cordova-plugin-statusbar
cordova-plugin-market
cordova-plugin-file-opener2
cordova-plugin-file
cordova-plugin-dialogs
cordova-plugin-splashscreen
cordova-universal-links-plugin
cordova-plugin-androidx-adapter
cordova-plugin-camera
cordova-plugin-ionic-webview
cordova-plugin-app-version
pushwoosh-cordova-plugin

Here's all search results for com.google.firebase: image

Jahrenski commented 1 year ago

I want to mention that the same is occurring while targeting Android sdk 32 as well

Techsorcist commented 1 year ago

@larskinn, @Jahrenski thanks for the info! We'll check it. Just to be sure, did you integrate the plugin according to the guide, that's correct?

unekinn commented 1 year ago

@Techsorcist

Just to be sure, did you integrate the plugin according to the guide, that's correct?

Yes. Pushwoosh has been working in our app for over two years.

wfhm commented 1 year ago

@larskinn @Jahrenski we found the issue on our side and it was fixed with the 8.3.7 release. Please update and let us know about the results.

@larskinn The strange thing is that you seemingly have 2 unrelated issues - we've fixed the one related to the registerDevice() method:

<app-dir>/platforms/android/app/src/main/java/com/pushwoosh/plugin/pushnotifications/PushNotifications.java:182: error: cannot find symbol
                                        if (result.isSuccess() && result.getData != null) {
                                                                        ^
  symbol:   variable getData
  location: variable result of type Result<RegisterForPushNotificationsResultData,RegisterForPushNotificationsException>

I could not reproduce the issues coming from CustomFirebaseMessagingService.java though. Could you please let me know if they persist after updating the plugin to 8.3.7?

Jahrenski commented 1 year ago

Hi! I deleted the platforms and plugins folders and installed the new version of the plugin. The build fails with the custom firebase error again.

C:\project\platforms\android\app\src\main\java\com\pushwoosh\plugin\pushnotifications\CustomFirebaseMessagingService.java:5: error: package com.google.firebase.messaging does not exist import com.google.firebase.messaging.FirebaseMessagingService; ^ C:\project\platforms\android\app\src\main\java\com\pushwoosh\plugin\pushnotifications\CustomFirebaseMessagingService.java:6: error: package com.google.firebase.messaging does not exist import com.google.firebase.messaging.RemoteMessage; ^ C:\project\platforms\android\app\src\main\java\com\pushwoosh\plugin\pushnotifications\CustomFirebaseMessagingService.java:9: error: cannot find symbol public class CustomFirebaseMessagingService extends FirebaseMessagingService { ^ symbol: class FirebaseMessagingService C:\project\platforms\android\app\src\main\java\com\pushwoosh\plugin\pushnotifications\CustomFirebaseMessagingService.java:11: error: cannot find symbol public void onMessageReceived(@NonNull RemoteMessage remoteMessage) { ^ symbol: class RemoteMessage location: class CustomFirebaseMessagingService C:\project\platforms\android\app\src\main\java\com\pushwoosh\plugin\pushnotifications\CustomFirebaseMessagingService.java:10: error: method does not override or implement a method from a supertype @Override ^ C:\project\platforms\android\app\src\main\java\com\pushwoosh\plugin\pushnotifications\CustomFirebaseMessagingService.java:19: error: method does not override or implement a method from a supertype @Override ^ C:\project\platforms\android\app\src\main\java\com\pushwoosh\plugin\pushnotifications\CustomFirebaseMessagingService.java:21: error: cannot find symbol super.onNewToken(s);

Here are my info :

Ionic:

   Ionic CLI                     : 6.20.1 (C:\Users\richard\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 6.2.6
   @angular-devkit/build-angular : 14.2.2
   @angular-devkit/schematics    : 14.2.2
   @angular/cli                  : 14.2.2
   @ionic/angular-toolkit        : 7.0.0

Cordova:

   Cordova CLI       : 11.0.0
   Cordova Platforms : android 11.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 14 other plugins)

Utility:

   cordova-res : 0.15.4
   native-run  : 1.7.0

System:

   Android SDK Tools : 26.1.1 (C:\Program Files (x86)\Android\android-sdk)
   NodeJS            : v16.13.0
   npm               : 8.19.1
   OS                : Windows 10
  Gradle            : 7.4.2
  Java jdk          : 17.0.4.1
unekinn commented 1 year ago

@wfhm On version 8.3.7 I now get the first 7 errors in my initial report. The quoted PushNotifications.java:182: error: cannot find symbol is gone.

wfhm commented 1 year ago

@Jahrenski could be something related to how dependencies are added in Ionic projects. Please let me pull some time to look into it.

@larskinn by any chance is your project Ionic-based as well? Could you please share what your environment is (Cordova/Ionic/Capacitor etc) and its version?

unekinn commented 1 year ago

@wfhm

by any chance is your project Ionic-based as well? Could you please share what your environment is (Cordova/Ionic/Capacitor etc) and its version?

We are using Cordova.

Cordova Packages:

    cli: 11.0.0
        common: 4.0.2
        create: 4.0.0
        lib: 11.0.0
            common: 4.0.2
            fetch: 3.0.1
            serve: 4.0.0

Project Installed Platforms:

    android: 11.0.0

Project Installed Plugins:

    cordova-plugin-androidx-adapter: 1.1.3
    cordova-plugin-app-version: 0.1.14
    cordova-plugin-calendar: 5.1.6
    cordova-plugin-camera: 6.0.0
    cordova-plugin-device: 2.0.3
    cordova-plugin-dialogs: 2.0.2
    cordova-plugin-file-opener2: 3.0.5
    cordova-plugin-file: 6.0.2
    cordova-plugin-geolocation: 4.1.0
    cordova-plugin-inappbrowser: 5.0.0
    cordova-plugin-ionic-webview: 5.0.0
    cordova-plugin-market: 1.2.0
    cordova-plugin-splashscreen: 6.0.0
    cordova-plugin-statusbar: 2.4.3
    cordova-universal-links-plugin: 1.2.1
    pushwoosh-cordova-plugin: 8.3.7

Environment:

    OS: macOS Monterey 12.5 (21G72) (darwin 21.6.0) arm64
    Node: v16.15.0
    npm: 8.13.2
Jahrenski commented 1 year ago

Any news on fixing this issue? The November deadline is approaching fast.

wfhm commented 1 year ago

@Jahrenski @larskinn I still could not reproduce the issue locally, so not much progress so far.

If you do not use any other push notification services, then you can simply delete the CustomFirebaseMessagingService.java from the plugin sources as a workaround. This class is actually only used if you enable it in config.xml or in AndroidManifest.xml

Jahrenski commented 1 year ago

Yeah it does compile when removing that file (and also its reference from Plugin.xml) but that would require us to fork the plugin and merge all future updates to stay up to date.

But it fails at runtime because it is expecting to find stuff relating to firebase.

09-26 11:02:30.727  8417  8417 E AndroidRuntime: FATAL EXCEPTION: main
09-26 11:02:30.727  8417  8417 E AndroidRuntime: Process: com.myapp.app, PID: 8417
09-26 11:02:30.727  8417  8417 E AndroidRuntime: java.lang.RuntimeException: Unable to get provider com.pushwoosh.PushwooshInitProvider: java.lang.IllegalStateException: You must add "implementation 'com.google.firebase:firebase-messaging:+'" line to your app build.gradle.
09-26 11:02:30.727  8417  8417 E AndroidRuntime: Check documentation for more info https://goo.gl/UVJKfp
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at android.app.ActivityThread.installProvider(ActivityThread.java:7755)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at android.app.ActivityThread.installContentProviders(ActivityThread.java:7291)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7187)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at android.app.ActivityThread.access$2200(ActivityThread.java:296)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2208)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:107)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:213)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:8178)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
09-26 11:02:30.727  8417  8417 E AndroidRuntime: Caused by: java.lang.IllegalStateException: You must add "implementation 'com.google.firebase:firebase-messaging:+'" line to your app build.gradle.
09-26 11:02:30.727  8417  8417 E AndroidRuntime: Check documentation for more info https://goo.gl/UVJKfp
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at com.pushwoosh.firebase.internal.checker.FirebaseChecker.check(Unknown Source:15)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at com.pushwoosh.firebase.internal.registrar.FcmRegistrar.init(Unknown Source:5)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at com.pushwoosh.notification.PushwooshNotificationManager.d(Unknown Source:2)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at com.pushwoosh.d.a(Unknown Source:59)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at com.pushwoosh.PushwooshPlatform.l(Unknown Source:2)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at com.pushwoosh.PushwooshInitializer.init(Unknown Source:70)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at com.pushwoosh.PushwooshInitProvider.onCreate(Unknown Source:11)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at android.content.ContentProvider.attachInfo(ContentProvider.java:2121)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at android.content.ContentProvider.attachInfo(ContentProvider.java:2094)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at android.app.ActivityThread.installProvider(ActivityThread.java:7750)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    ... 10 more
09-26 11:02:30.727  8417  8417 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: com.google.firebase.messaging.FirebaseMessaging
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at java.lang.Class.classForName(Native Method)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at java.lang.Class.forName(Class.java:454)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at java.lang.Class.forName(Class.java:379)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at com.pushwoosh.firebase.internal.checker.FirebaseChecker.check(Unknown Source:2)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    ... 19 more
09-26 11:02:30.727  8417  8417 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.messaging.FirebaseMessaging" on path: DexPathList[[zip file "/data/app/com.myapp.app-YW-Ph8lz99yio1wsMrC_3g==/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp.app-YW-Ph8lz99yio1wsMrC_3g==/lib/arm64, /system/lib64, /system/product/lib64, /hw_product/lib64, /system/product/lib64, /prets/lib64]]
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
09-26 11:02:30.727  8417  8417 E AndroidRuntime:    ... 23 more
Jahrenski commented 1 year ago

I created a new cordova (not ionic) app from scratch and only added pushwoosh as a plugin and nothing else and I still get the compilation error so it has nothing to do with ionic or angular or other plugins interfering.

F:\Desktop\tmp\testdelete\hello\platforms\android\app\src\main\java\com\pushwoosh\plugin\pushnotifications\CustomFirebaseMessagingService.java:5: error: package com.google.firebase.messaging does not exist
import com.google.firebase.messaging.FirebaseMessagingService;
                                    ^
F:\Desktop\tmp\testdelete\hello\platforms\android\app\src\main\java\com\pushwoosh\plugin\pushnotifications\CustomFirebaseMessagingService.java:6: error: package com.google.firebase.messaging does not exist
import com.google.firebase.messaging.RemoteMessage;
                                    ^
F:\Desktop\tmp\testdelete\hello\platforms\android\app\src\main\java\com\pushwoosh\plugin\pushnotifications\CustomFirebaseMessagingService.java:9: error: cannot find symbol
public class CustomFirebaseMessagingService extends FirebaseMessagingService {
                                                    ^
  symbol: class FirebaseMessagingService
F:\Desktop\tmp\testdelete\hello\platforms\android\app\src\main\java\com\pushwoosh\plugin\pushnotifications\CustomFirebaseMessagingService.java:11: error: cannot find symbol
    public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
                                           ^
  symbol:   class RemoteMessage
  location: class CustomFirebaseMessagingService
F:\Desktop\tmp\testdelete\hello\platforms\android\app\src\main\java\com\pushwoosh\plugin\pushnotifications\CustomFirebaseMessagingService.java:10: error: method does not override or implement a method from a supertype
    @Override
    ^
F:\Desktop\tmp\testdelete\hello\platforms\android\app\src\main\java\com\pushwoosh\plugin\pushnotifications\CustomFirebaseMessagingService.java:19: error: method does not override or implement a method from a supertype
    @Override
    ^
F:\Desktop\tmp\testdelete\hello\platforms\android\app\src\main\java\com\pushwoosh\plugin\pushnotifications\CustomFirebaseMessagingService.java:21: error: cannot find symbol
        super.onNewToken(s);
        ^
  symbol:   variable super
  location: class CustomFirebaseMessagingService

Here are the config.xml and package.json for a very minimal reproduction. (my google-services.json not included) hello.zip

wfhm commented 1 year ago

@Jahrenski just did the same and still no compilation errors. Does it happen in debug or release version of the app, or both?

Jahrenski commented 1 year ago

Same happens with both debug and release.

wfhm commented 1 year ago

@Jahrenski got it reproduced after updating gradle version - my projects were all using an older one. For some reason, Firebase Messaging library classes are not accessible from the plugin after the update. While we are looking into it, you can simply comment out the following line in the plugin's plugin.xml:

<source-file src="src/android/src/com/pushwoosh/plugin/pushnotifications/CustomFirebaseMessagingService.java"
            target-dir="src/com/pushwoosh/plugin/pushnotifications"/>

Then remove and re-add Android platform for changes to take into effect. Make sure you update plugin.xml of the plugin located in /plugins directory, not in node_modules.

Jahrenski commented 1 year ago

This is the same as above. Removing this line compiles yes, but crashes at runtime immediately.

09-26 13:17:18.376 15729 15729 E AndroidRuntime: FATAL EXCEPTION: main
09-26 13:17:18.376 15729 15729 E AndroidRuntime: Process: com.example.hello, PID: 15729
09-26 13:17:18.376 15729 15729 E AndroidRuntime: java.lang.RuntimeException: Unable to get provider com.pushwoosh.PushwooshInitProvider: java.lang.IllegalStateException: You must add "implementation 'com.google.firebase:firebase-messaging:+'" line to your app build.gradle.
09-26 13:17:18.376 15729 15729 E AndroidRuntime: Check documentation for more info https://goo.gl/UVJKfp
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at android.app.ActivityThread.installProvider(ActivityThread.java:7755)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at android.app.ActivityThread.installContentProviders(ActivityThread.java:7291)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7187)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at android.app.ActivityThread.access$2200(ActivityThread.java:296)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2208)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:107)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:213)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:8178)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
09-26 13:17:18.376 15729 15729 E AndroidRuntime: Caused by: java.lang.IllegalStateException: You must add "implementation 'com.google.firebase:firebase-messaging:+'" line to your app build.gradle.
09-26 13:17:18.376 15729 15729 E AndroidRuntime: Check documentation for more info https://goo.gl/UVJKfp
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at com.pushwoosh.firebase.internal.checker.FirebaseChecker.check(Unknown Source:15)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at com.pushwoosh.firebase.internal.registrar.FcmRegistrar.init(Unknown Source:5)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at com.pushwoosh.notification.PushwooshNotificationManager.d(Unknown Source:2)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at com.pushwoosh.d.a(Unknown Source:59)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at com.pushwoosh.PushwooshPlatform.l(Unknown Source:2)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at com.pushwoosh.PushwooshInitializer.init(Unknown Source:70)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at com.pushwoosh.PushwooshInitProvider.onCreate(Unknown Source:11)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at android.content.ContentProvider.attachInfo(ContentProvider.java:2121)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at android.content.ContentProvider.attachInfo(ContentProvider.java:2094)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at android.app.ActivityThread.installProvider(ActivityThread.java:7750)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    ... 10 more
09-26 13:17:18.376 15729 15729 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: com.google.firebase.messaging.FirebaseMessaging
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at java.lang.Class.classForName(Native Method)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at java.lang.Class.forName(Class.java:454)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at java.lang.Class.forName(Class.java:379)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at com.pushwoosh.firebase.internal.checker.FirebaseChecker.check(Unknown Source:2)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    ... 19 more
09-26 13:17:18.376 15729 15729 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.messaging.FirebaseMessaging" on path: DexPathList[[zip file "/data/app/com.example.hello-Sa7XBb1ZNYgXdNiG7yrV1w==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.hello-Sa7XBb1ZNYgXdNiG7yrV1w==/lib/arm64, /system/lib64, /system/product/lib64, /hw_product/lib64, /system/product/lib64, /prets/lib64]]
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
09-26 13:17:18.376 15729 15729 E AndroidRuntime:    ... 23 more
wfhm commented 1 year ago

@Jahrenski okay, so, apparently, cordova-android@11.0.0 does not allow you specifying dependency version range anymore. Right now the plugin adds Firebase dependencies as below:

        <framework src="com.google.firebase:firebase-core:(+,19.0.99]" />
        <framework src="com.google.firebase:firebase-messaging:(+,22.0.99]" />

This is intentionally done to avoid using the latest alpha versions of these libs. The fix is to replace the version range with a particular version or just with the "+" sign to use the latest available version:

        <framework src="com.google.firebase:firebase-core:+" />
        <framework src="com.google.firebase:firebase-messaging:+" />

However, before we apply such changes, I want to check if there is any alternative to avoid using alpha versions. In the meantime, you can manually update the plugin's plugin.xml to use the latest version (or any particular version).

Jahrenski commented 1 year ago

I can confirm that using the following compiles and runs :

<framework src="com.google.firebase:firebase-core:+" />
<framework src="com.google.firebase:firebase-messaging:+" />

We will be waiting for the official release of this patch. Thanks.

wfhm commented 1 year ago

@Jahrenski @larskinn Fixed in 8.3.8. Please let us know if the issue persists

Jahrenski commented 1 year ago

It seems to be working thanks!