dpa99c / cordova-plugin-firebasex

Cordova plugin for Google Firebase
MIT License
572 stars 462 forks source link

Crashes on Huawei Devices #535

Closed Akz47 closed 3 years ago

Akz47 commented 3 years ago

We are seeing Firebasex plugin crashes on certain Huawei devices.

For example, Google Play Console shows the following crash report:

Huawei nova 3i (HWINE), 3840MB RAM, Android 9

java.lang.NullPointerException: 
  at org.apache.cordova.firebase.FirebasePlugin.handleExceptionWithContext (FirebasePlugin.java:2332)
  at org.apache.cordova.firebase.FirebasePlugin$49.run (FirebasePlugin.java:1724)
  at java.util.concurrent.ThreadPoolExecutor.processTask (ThreadPoolExecutor.java:1187)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1152)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
  at java.lang.Thread.run (Thread.java:784)

We are currently using:

We believe it is because Google Play Services is not available on these devices.

How best do we use Firebasex plugin to check if Play Services is available, and if not, which Firebasex functions / APIs should we disable?

Thank you.

dpa99c commented 3 years ago

Please update to the latest plugin version (v11.0.2) and retest since the version you are using (v9.1.0) is considerably out-of-date.

Akz47 commented 3 years ago

Thank you for your advice, we'll give that a try and see if that resolves the crashes.

Generally speaking, newer Huawei devices no longer carry Google's Play Store / Apps and comes with its own AppGallery, requiring its own SDK and Push Kit for integrating push notifications.

How does Firebasex behave under such scenarios, does it automatically detect the lack of Google Play Services and disregard push notifications etc for such incompatible devices?

Akz47 commented 3 years ago

Hi Dave,

We removed the old cordova-plugin-firebasex and reinstalled the updated 11.0.2 version, but the Android build now fails.

Below are the commands we ran:

cordova plugin rm cordova-plugin-firebasex
cordova plugin add cordova-plugin-firebasex
cordova clean android
cordova build android

This is the output once we run the cordova build android:

> Task :app:transformClassesWithFirebasePerformancePluginForDebug
java.lang.ClassNotFoundException: android.graphics.fonts.Font
.\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\11\com\google\firebase\perf\network\InstrumentApacheHttpResponseHandler.class: D8: Interface `org.apache.http.client.ResponseHandler` not found. It's needed to make sure desugaring of `com.google.firebase.perf.network.InstrumentApacheHttpResponseHandler` is correct. Desugaring will assume that this interface has no default method.
.\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\21\module-info.class: D8: Illegal class file: Class module-info is missing a super type. Class file version 53.
.\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\25\com\google\android\gms\internal\gtm\zztx$zza.class: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.gtm.zztx$zza.zza(long, byte)`
.\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\25\com\google\android\gms\internal\gtm\zztx$zzb.class: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.gtm.zztx$zzb.zza(long, byte)`
.\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\39\com\google\android\gms\internal\clearcut\zzfd$zzb.class: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.clearcut.zzfd$zzb.zza(long, byte)`
.\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\39\com\google\android\gms\internal\clearcut\zzfd$zza.class: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.clearcut.zzfd$zza.zza(long, byte)`
.\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\71\androidx\core\graphics\Insets.class: D8: Type `android.graphics.Insets` was not found, it is required for default or static interface methods desugaring of `android.graphics.Insets androidx.core.graphics.Insets.toPlatformInsets()`
.\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\100\okhttp3\internal\platform\ConscryptPlatform.class: D8: Type `org.conscrypt.Conscrypt` was not found, it is required for default or static interface methods desugaring of `java.security.Provider okhttp3.internal.platform.ConscryptPlatform.getProvider()`
.\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\112\com\google\common\primitives\UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator.class: D8: Type `sun.misc.Unsafe` was not found, it is required for default or static interface methods desugaring of `sun.misc.Unsafe com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator.getUnsafe()`

com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process .\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\21
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
        at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
        at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)
        at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:146)
        at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.transform(DexArchiveBuilderTransform.java:420)
        at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:239)
        at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:235)
        at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
        at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:4
        ....

* What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process .\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\21

This is our plugin list:

cordova-custom-config 5.1.0 "cordova-custom-config"
cordova-plugin-activityindicator 1.0.5 "Activity Indicator"
cordova-plugin-appavailability 0.4.2 "AppAvailability"
cordova-plugin-camera 4.1.0 "Camera"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-dialogs 2.0.2 "Notification"
cordova-plugin-facebook4 6.4.0 "Facebook Connect"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-firebasex 11.0.2 "Google Firebase Plugin"
cordova-plugin-geolocation 4.0.2 "Geolocation"
cordova-plugin-inappbrowser 3.1.0 "InAppBrowser"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-plugin-x-socialsharing 5.6.2 "SocialSharing"
es6-promise-plugin 4.2.2 "Promise"

In Cordova's config.xml, the minSdkVersion is 21 and targetSdkVersion is 29.

Can you please advise if we are missing some module or need to update some compilation parameters? Thank you.

dpa99c commented 3 years ago

Try removing and replacing the Android platform: cordova platform rm android --nosave && cordova platform add android --nosave.

If that doesn't work, try building the example project to see if the problem is specific to your project or your development environment.

Akz47 commented 3 years ago

We managed to narrow the problem down to specifically Firebasex 11.0.2 which produced those errors like "java.lang.ClassNotFoundException: android.graphics.fonts.Font". If we used 10.2.0 / 11.0.0 / 11.0.1, it compiles perfectly fine.

We also tried replacing the Android platform, but the Firebasex 11.0.2 errors remained. We then tried the example project, which also produced similar errors:

> Task :app:transformClassesWithFirebasePerformancePluginForDebug UP-TO-DATE
.\cordova-plugin-firebasex-test\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\7\com\google\firebase\perf\network\zze.class: D8: Interface `org.apache.http.client.ResponseHandler` not found. It's needed to make sure desugaring of `com.google.firebase.perf.network.zze` is correct. Desugaring will assume that this interface has no default method.
.\cordova-plugin-firebasex-test\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\18\module-info.class: D8: Illegal class file: Class module-info is missing a super type. Class file version 53.
.\cordova-plugin-firebasex-test\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\19\com\google\android\gms\internal\gtm\zztx$zzb.class: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.gtm.zztx$zzb.zza(long, byte)`
.\cordova-plugin-firebasex-test\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\19\com\google\android\gms\internal\gtm\zztx$zza.class: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.gtm.zztx$zza.zza(long, byte)`
.\cordova-plugin-firebasex-test\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\29\com\google\android\gms\internal\clearcut\zzfd$zzb.class: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.clearcut.zzfd$zzb.zza(long, byte)`
.\cordova-plugin-firebasex-test\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\29\com\google\android\gms\internal\clearcut\zzfd$zza.class: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.clearcut.zzfd$zza.zza(long, byte)`
.\cordova-plugin-firebasex-test\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\76\okhttp3\internal\platform\ConscryptPlatform.class: D8: Type `org.conscrypt.Conscrypt` was not found, it is required for default or static interface methods desugaring of `java.security.Provider okhttp3.internal.platform.ConscryptPlatform.getProvider()`
.\cordova-plugin-firebasex-test\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\101\com\google\common\primitives\UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator.class: D8: Type `sun.misc.Unsafe` was not found, it is required for default or static interface methods desugaring of `sun.misc.Unsafe com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator.getUnsafe()`

com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process .\cordova-plugin-firebasex-test\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\18
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
        at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
        at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)
        ...
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
        at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:70)
        at com.android.tools.r8.utils.ExceptionUtils.withD8CompilationHandler(ExceptionUtils.java:43)
        at com.android.tools.r8.D8.run(D8.java:94)
        at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:99)
        ... 7 more
Caused by: com.android.tools.r8.utils.AbortException: Error: .\cordova-plugin-firebasex-test\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\18\module-info.class, Illegal class file: Class module-info is missing a super type. Class file version 53.
        at com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:89)
        at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:60)
        at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:64)
        ... 10 more

> Task :app:transformClassesWithDexBuilderForDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process .\cordova-plugin-firebasex-test\platforms\android\app\build\intermediates\transforms\FirebasePerformancePlugin\debug\18

Is it because Firebasex 11.0.2 added some new external library / dependency that is missing? We are running Cordova on Windows 10.

Another weird thing is after we installed 11.0.2, then removed it and try installing 11.0.1 or lower, then the same error will happen, even though "cordova clean android" was run. 11.0.2 plugin must not be installed or removed, we need to directly upgrade to 11.0.1 or lower, then compilation works.

Please advise, thank you.

dpa99c commented 3 years ago

v11.0.2 adds the Firebase Performance Gradle plugin for monitoring network requests on Android so maybe this is what's causing your build issues?

I tried also building the example project for Android on Windows but for me it works fine:

console output ``` $ cd /cygdrive/d/Temp/ $ git clone https://github.com/dpa99c/cordova-plugin-firebasex-test Cloning into 'cordova-plugin-firebasex-test'... remote: Enumerating objects: 275, done. remote: Counting objects: 100% (275/275), done. remote: Compressing objects: 100% (189/189), done. remote: Total 646 (delta 160), reused 192 (delta 85), pack-reused 371 Receiving objects: 100% (646/646), 381.43 KiB | 347.00 KiB/s, done. Resolving deltas: 100% (353/353), done. $ cd cordova-plugin-firebasex-test/ $ cordova platform add android Using cordova-fetch for cordova-android@^9.0.0 Adding android project... Creating Cordova project for the Android platform: Path: platforms\android Package: uk.co.workingedge.firebase.test Name: FirebaseTest Activity: MainActivity Android target: android-29 Subproject Path: CordovaLib Subproject Path: app Android project created with cordova-android@9.0.0 [Gradle Properties] Detected Gradle property "android.useAndroidX" with the value of "true", Cordova's recommended value is "false" [Gradle Properties] Detected Gradle property "android.enableJetifier" with the value of "true", Cordova's recommended value is "false" Installing "cordova-plugin-customfcmreceiver" for android Discovered plugin "cordova-plugin-whitelist". Adding it to the project Installing "cordova-plugin-whitelist" for android Adding cordova-plugin-whitelist to package.json Discovered plugin "cordova-plugin-firebasex". Adding it to the project Installing "cordova-plugin-firebasex" for android Subproject Path: CordovaLib Subproject Path: app Adding cordova-plugin-firebasex to package.json Discovered plugin "cordova-custom-config". Adding it to the project Installing "cordova-custom-config" for android Adding cordova-custom-config to package.json Discovered plugin "cordova-plugin-dialogs". Adding it to the project Installing "cordova-plugin-dialogs" for android Adding cordova-plugin-dialogs to package.json Discovered plugin "cordova-plugin-enable-multidex". Adding it to the project Installing "cordova-plugin-enable-multidex" for android Subproject Path: CordovaLib Subproject Path: app Adding cordova-plugin-enable-multidex to package.json Discovered plugin "cordova-plugin-androidx-adapter". Adding it to the project Installing "cordova-plugin-androidx-adapter" for android Adding cordova-plugin-androidx-adapter to package.json Discovered plugin "cordova-plugin-hello-c". Adding it to the project Installing "cordova-plugin-hello-c" for android Adding cordova-plugin-hello-c to package.json [Gradle Properties] Detected Gradle property "android.useAndroidX" with the value of "true", Cordova's recommended value is "false" [Gradle Properties] Detected Gradle property "android.enableJetifier" with the value of "true", Cordova's recommended value is "false" cordova-custom-config: Applied custom config from config.xml to D:\Temp\cordova-plugin-firebasex-test\platforms\android\app\src\main\AndroidManifest.xml cordova-plugin-androidx-adapter: Processed 23 source files in 300ms cordova-plugin-firebasex: Preparing Firebase on Android cordova-plugin-firebasex: Updated colors.xml with accent color cordova-plugin-firebasex: Added dependency to root gradle: com.google.firebase:perf-plugin:1.3.1 cordova-plugin-firebasex: Applied plugin to app gradle: com.google.firebase.firebase-perf $ cordova plugin ls cordova-custom-config 5.1.0 "cordova-custom-config" cordova-plugin-androidx-adapter 1.1.1 "cordova-plugin-androidx-adapter" cordova-plugin-customfcmreceiver 1.0.0 "Custom FCM Receiver" cordova-plugin-dialogs 1.3.2-dev "Notification" cordova-plugin-enable-multidex 0.2.0 "Enable Multidex" cordova-plugin-firebasex 11.0.2 "Google Firebase Plugin" cordova-plugin-hello-c 1.1.1 "Hello" cordova-plugin-whitelist 1.3.4 "Whitelist" $ platforms/android/gradlew -v ------------------------------------------------------------ Gradle 6.1.1 ------------------------------------------------------------ Build time: 2020-01-24 22:30:24 UTC Revision: a8c3750babb99d1894378073499d6716a1a1fa5d Kotlin: 1.3.61 Groovy: 2.5.8 Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019 JVM: 1.8.0_161 (Oracle Corporation 25.161-b12) OS: Windows 10 10.0 amd64 $ cp /cygdrive/d/Git/cordova-plugin-firebasex-test/google-services.json . $ cordova build android cordova-custom-config: Skipping auto-restore of config file backup(s) [Gradle Properties] Detected Gradle property "android.useAndroidX" with the value of "true", Cordova's recommended value is "false" [Gradle Properties] Detected Gradle property "android.enableJetifier" with the value of "true", Cordova's recommended value is "false" cordova-custom-config: Applied custom config from config.xml to D:\Temp\cordova-plugin-firebasex-test\platforms\android\app\src\main\AndroidManifest.xml cordova-plugin-androidx-adapter: Processed 23 source files in 264ms cordova-plugin-firebasex: Preparing Firebase on Android cordova-plugin-firebasex: Updated colors.xml with accent color Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=C:\Users\dpa99\AppData\Local\Android\sdk (recommended setting) ANDROID_HOME=C:\Users\dpa99\AppData\Local\Android\sdk (DEPRECATED) Using Android SDK: C:\Users\dpa99\AppData\Local\Android\sdk Subproject Path: CordovaLib Subproject Path: app > Task :app:preBuild UP-TO-DATE > Task :app:preDebugBuild UP-TO-DATE > Task :CordovaLib:preBuild UP-TO-DATE > Task :CordovaLib:preDebugBuild UP-TO-DATE > Task :CordovaLib:compileDebugAidl NO-SOURCE > Task :CordovaLib:packageDebugRenderscript NO-SOURCE > Task :app:generateDebugBuildConfig UP-TO-DATE > Task :app:javaPreCompileDebug UP-TO-DATE > Task :app:compileDebugRenderscript NO-SOURCE > Task :app:compileDebugAidl NO-SOURCE > Task :app:generateDebugResValues UP-TO-DATE > Task :app:generateDebugResources UP-TO-DATE > Task :app:injectCrashlyticsMappingFileIdDebug > Task :app:processDebugGoogleServices Parsing json file: D:\Temp\cordova-plugin-firebasex-test\platforms\android\app\google-services.json > Task :CordovaLib:compileDebugRenderscript > Task :CordovaLib:generateDebugResValues > Task :CordovaLib:generateDebugResources > Task :CordovaLib:packageDebugResources > Task :app:createDebugCompatibleScreenManifests > Task :app:extractDeepLinksDebug > Task :CordovaLib:extractDeepLinksDebug > Task :CordovaLib:generateDebugBuildConfig > Task :CordovaLib:processDebugManifest > Task :app:processDebugManifest D:\Temp\cordova-plugin-firebasex-test\platforms\android\app\src\main\AndroidManifest.xml:24:9-31:50 Warning: activity#com.google.firebase.auth.internal.FederatedSignInActivity@android:launchMode was tagged at AndroidManifest.xml:24 to replace other declarations but no other declaration present > Task :CordovaLib:compileDebugLibraryResources > Task :app:mergeDebugResources > Task :CordovaLib:javaPreCompileDebug > Task :CordovaLib:parseDebugLocalResources > Task :app:mergeDebugShaders > Task :app:compileDebugShaders NO-SOURCE > Task :app:generateDebugAssets UP-TO-DATE > Task :CordovaLib:mergeDebugShaders > Task :CordovaLib:compileDebugShaders NO-SOURCE > Task :CordovaLib:generateDebugAssets UP-TO-DATE > Task :CordovaLib:packageDebugAssets > Task :app:mergeDebugAssets > Task :CordovaLib:generateDebugRFile > Task :app:processDebugResources > Task :CordovaLib:compileDebugJavaWithJavac > Task :app:processDebugJavaRes NO-SOURCE > Task :CordovaLib:processDebugJavaRes NO-SOURCE > Task :CordovaLib:bundleLibResDebug NO-SOURCE > Task :CordovaLib:bundleLibCompileToJarDebug > Task :app:compileDebugJavaWithJavac Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. > Task :app:compileDebugSources > Task :app:checkDebugDuplicateClasses > Task :CordovaLib:bundleLibRuntimeToJarDebug > Task :app:transformClassesWithFirebasePerformancePluginForDebug > Task :app:mergeDebugJavaResource > Task :app:dexBuilderDebug > Task :app:mergeLibDexDebug > Task :app:mergeExtDexDebug > Task :app:mergeDebugJniLibFolders > Task :CordovaLib:mergeDebugJniLibFolders > Task :app:validateSigningDebug > Task :CordovaLib:mergeDebugNativeLibs > Task :CordovaLib:stripDebugDebugSymbols NO-SOURCE > Task :CordovaLib:copyDebugJniLibsProjectOnly > Task :app:mergeDebugNativeLibs > Task :app:stripDebugDebugSymbols WARNING: Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead. Support for ANDROID_NDK_HOME is deprecated and will be removed in the future. Use android.ndkVersion in build.gradle instead. Expiring Daemon because JVM heap space is exhausted > Task :app:mergeProjectDexDebug > Task :app:packageDebug > Task :app:assembleDebug > Task :app:cdvBuildDebug 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 https://docs.gradle.org/6.1.1/userguide/command_line_interface.html#sec:command_line_warnings BUILD SUCCESSFUL in 3m 53s 43 actionable tasks: 40 executed, 3 up-to-date Built the following apk(s): D:\Temp\cordova-plugin-firebasex-test\platforms\android\app\build\outputs\apk\debug\app-debug.apk ```
Akz47 commented 3 years ago

Thanks for promptly testing it out on your Windows. Yes, the Firebase Performance Plugin seems like the cause of the build issues.

The plugin versions are identical, but our gradlew is an older version:

------------------------------------------------------------
Gradle 4.10.3
------------------------------------------------------------
Build time:   2018-12-05 00:50:54 UTC
Revision:     e76905e3a1034e6f724566aeb985621347ff43bc

Kotlin DSL:   1.0-rc-6
Kotlin:       1.2.61
Groovy:       2.4.15
Ant:          Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM:          1.8.0_242-release (JetBrains s.r.o 25.242-b01)
OS:           Windows 10 10.0 amd64

Could our old gradle be the cause of incompatibility? We are wary of upgrading gradle, in case it causes compilation or configuration issues to our existing apps. Is there any way we can disable the Firebase Performance Plugin feature in 11.0.2. via config.xml or something?

If not, then we'll just proceed to use 11.0.1 for now.

dpa99c commented 3 years ago

The Firebase Performance Monitoring Gradle plugin requires Android Studio v4.0+ and Gradle v6.1.1+ hence your build problems with it. It also adds significant overhead to Android build times and memory requirements as outlined here. So I've made it an opt-in feature via this commit - it will go it out with the next release.

However I highly recommend upgrading your Gradle (and Android Studio) versions as it's likely newer versions of the Firebase SDK for Android will add dependency requirements for a higher version so future versions of this plugin may cause your builds to fail if you continue to use an old version of Gradle.

dpa99c commented 3 years ago

With regard to the original topic of this issue, the crashes you are seen arise here because the plugin instance is null so attempting to invoke an instance method is resulting in a NullPointerException. I'll add some defensive code to mitigate this.

With regard to running on Android devices which lack Google Play Services, the Firebase SDK is inherently dependent on it so I would think many Firebase features will not work properly. However this isn't something that I can explicity offer support for; the best this plugin can do is to gracefully handle any exceptions (such as the one above) that arise and catch them to prevent the app crashing. It is then up to the app to decide how to handle failed Firebase operations due to the lack of Play Services.

Akz47 commented 3 years ago

Hi Dave, thank you for so promptly releasing an update to fix the issues, you're absolutely amazing!

We have just updated the plugin, and the compilation works great now. We are now sourcing for Huawei devices / emulators to test the updated version and see if it runs smoothly.

You mentioned that Firebase SDK is dependent upon Google Play Services. Is there any method in your Firebasex plugin we can call to determine if Google Play Services is present? Then based on that, our app could turn off dependent features. Would Firebase Analytics still work, since it is just reporting app events?

It would not be accurate for our app to detect based on the Huawei brand specifically, since their older devices (before a certain cutoff date) still have Google services installed.

We may try out this plugin, but it would be ideal if Firebasex already has such a checking available: https://github.com/pavelety/cordova-plugin-google-play-services-checker

During the compilation, there are a few warning messages:

> Transform interpolator.aar (androidx.interpolator:interpolator:1.0.0) with AarTransform
.\.gradle\caches\transforms-1\files-1.1\firebase-perf-19.0.9.aar\a3fdf5c1dfe53f4d137aa0a7d3437a39\jars\classes.jar: D8: Interface `org.apache.http.client.ResponseHandler` not found. It's needed to make sure desugaring of `com.google.firebase.perf.network.InstrumentApacheHttpResponseHandler` is correct. Desugaring will assume that this interface has no default method.
.\.gradle\caches\transforms-1\files-1.1\play-services-clearcut-17.0.0.aar\39c45b972a63d90f6fe075b3947169eb\jars\classes.jar: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.clearcut.zzfd$zzb.zza(long, byte)`
.\.gradle\caches\transforms-1\files-1.1\play-services-clearcut-17.0.0.aar\39c45b972a63d90f6fe075b3947169eb\jars\classes.jar: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.clearcut.zzfd$zza.zza(long, byte)`
.\.gradle\caches\transforms-1\files-1.1\core-1.3.0.aar\4432b6ee552f62b2457bbe4fb316d65b\jars\classes.jar: D8: Type `android.graphics.Insets` was not found, it is required for default or static interface methods desugaring of `android.graphics.Insets androidx.core.graphics.Insets.toPlatformInsets()`

Are these related to our Gradle version, and will there be any potential issues / crashes since it involves some missing libraries? Or are these solely used by Firebase Performance Monitoring plugin and can be ignored as long as that plugin is disabled?

dpa99c commented 3 years ago

Is there any method in your Firebasex plugin we can call to determine if Google Play Services is present?

It may be possible for this plugin to do something like this to check if Play Services is available and potentially get it to show an error dialog.

During the compilation, there are a few warning messages

Firebase Performance Monitoring is only one of the errors raised there so I believe the problem is independent of that - there's a similar error trace in #21. I suggest building the example project to see if these errors are due to your build environment (e.g. Gradle version) or specific to your project (e.g. plugin conflict).

Akz47 commented 3 years ago

It may be possible for this plugin to do something like this to check if Play Services is available and potentially get it to show an error dialog.

Such a check would be very helpful indeed! Hopefully this will be available in a future Firebasex release, as we are seeing an increasing number of Huawei crashes recently due to the newer models without Google Play Services.

Meanwhile, would Firebase Analytics still work without Google Play Service, since it is just reporting app events?

I suggest building the example project to see if these errors are due to your build environment (e.g. Gradle version) or specific to your project (e.g. plugin conflict).

We have tried it with the test project, the warning messages are similar though it seems to be more. Is it fine to disregard these errors?

> Transform firebase-encoders-json.aar (com.google.firebase:firebase-encoders-json:17.0.0) with AarTransform
.\.gradle\caches\transforms-1\files-1.1\firebase-perf-19.0.9.aar\a3fdf5c1dfe53f4d137aa0a7d3437a39\jars\classes.jar: D8: Interface `org.apache.http.client.ResponseHandler` not found. It's needed to make sure desugaring of `com.google.firebase.perf.network.InstrumentApacheHttpResponseHandler` is correct. Desugaring will assume that this interface has no default method.
.\.gradle\caches\transforms-1\files-1.1\play-services-analytics-impl-17.0.0.aar\470fa3eb346f03502419b6775e796bd6\jars\classes.jar: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.gtm.zztx$zza.zza(long, byte)`
.\.gradle\caches\transforms-1\files-1.1\play-services-analytics-impl-17.0.0.aar\470fa3eb346f03502419b6775e796bd6\jars\classes.jar: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.gtm.zztx$zzb.zza(long, byte)`
.\.gradle\caches\transforms-1\files-1.1\play-services-clearcut-17.0.0.aar\39c45b972a63d90f6fe075b3947169eb\jars\classes.jar: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.clearcut.zzfd$zzb.zza(long, byte)`
.\.gradle\caches\transforms-1\files-1.1\play-services-clearcut-17.0.0.aar\39c45b972a63d90f6fe075b3947169eb\jars\classes.jar: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.clearcut.zzfd$zza.zza(long, byte)`
.\.gradle\caches\transforms-1\files-1.1\core-1.3.0.aar\4432b6ee552f62b2457bbe4fb316d65b\jars\classes.jar: D8: Type `android.graphics.Insets` was not found, it is required for default or static interface methods desugaring of `android.graphics.Insets androidx.core.graphics.Insets.toPlatformInsets()`
.\.gradle\caches\transforms-1\files-1.1\okhttp-3.12.1.jar\92738a01ca555872fef4756ffc0bca64\jetified-okhttp-3.12.1.jar: D8: Type `org.conscrypt.Conscrypt` was not found, it is required for default or static interface methods desugaring of `java.security.Provider okhttp3.internal.platform.ConscryptPlatform.getProvider()`
.\.gradle\caches\transforms-1\files-1.1\guava-28.1-android.jar\ea488cbad7f19aed331ae3015f0c8122\jetified-guava-28.1-android.jar: D8: Type `sun.misc.Unsafe` was not found, it is required for default or static interface methods desugaring of `sun.misc.Unsafe com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator.getUnsafe()`
.\.gradle\caches\transforms-1\files-1.1\guava-28.1-android.jar\ea488cbad7f19aed331ae3015f0c8122\jetified-guava-28.1-android.jar: D8: Type `sun.misc.Unsafe` was not found, it is required for default or static interface methods desugaring of `void com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper.<clinit>()`

Thank you for your help.