Closed Akz47 closed 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.
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?
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.
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.
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.
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:
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.
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.
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.
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?
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).
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.
We are seeing Firebasex plugin crashes on certain Huawei devices.
For example, Google Play Console shows the following crash report:
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.