Googleplayservicescomponents: Xamarin.Firebase.Crashlytics : Java.Lang.NoSuchMethodError: No static method checkBuilderRequirement

Created on 24 Sep 2020  Â·  10Comments  Â·  Source: xamarin/GooglePlayServicesComponents

Xamarin.Android Version (eg: 6.0):

10.2.0.100

Operating System & Version (eg: Mac OSX 10.11):

macOS 10.15.4 (19E287)

Describe your Issue

I added Xamarin.Firebase.Crashlytics to my Xamarin.Forms solution.
I ran it on an Android device, and the title error occurs at app startup.

This is my detailed procedure.

  1. Added the Xamarin.Firebase.Crashlytics 117.0.0-preview02 NuGet package to my Xamarin.Android project.
  2. I put google-services.json downloaded from the Firebase site into my Xamarin.Android project.
    The build action is Google Services Json.
  3. I created Resources/values​​/strings.xml and wrote it as follows.
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="com.crashlytics.android.build_id">1.0</string>
</resources>
  1. I ran it on an Android device.

Relevant information

Packages used:

    <PackageReference Include="Xamarin.Forms" Version="4.6.0.726" />
    <PackageReference Include="Xamarin.Essentials" Version="1.5.1" />
    <PackageReference Include="Xamarin.Firebase.Crashlytics">
      <Version>117.0.0-preview02</Version>
    </PackageReference>

Build settings (tools)

    <AndroidDexTool>d8</AndroidDexTool>
    <AndroidEnableMultiDex>false</AndroidEnableMultiDex>

Include any relevant Exception Stack traces, build logs, adb logs:

I attached.
errLog.txt

Most helpful comment

It seems one of the nugets Xamarin.Firebase.Crashlytics depends upon (Xamarin.Google.Android.DataTransport.TransportRuntime) is using older version of Xamarin.Google.Dagger (2.1.3).

I don't have this exception after Installing Xamarin.Google.Dagger 2.25.2.1 directly into Android project.

All 10 comments

I tried update the version of Xamarin.Android.
Xamarin.Android Version : 11.0.2.0

Previously, I got a build error unless I set AndroidEnableMultiDex to false, but after the update, I set it to true and the build passed.

But I get the same Java.Lang.NoSuchMethodError.

As you know, we MUST upgrade to the new Firebase Crashlytics SDK by November 15, 2020.
We, the developers who used to use Xamarin.Android.Crashlytics, have high expectations for Xamarin.Firebase.Crashlytics.
So please, please be corresponding.

It seems one of the nugets Xamarin.Firebase.Crashlytics depends upon (Xamarin.Google.Android.DataTransport.TransportRuntime) is using older version of Xamarin.Google.Dagger (2.1.3).

I don't have this exception after Installing Xamarin.Google.Dagger 2.25.2.1 directly into Android project.

Hi sasa-bobic,
Thank you for your advice! Java.Lang.NoSuchMethodError no longer occurs.

But, this time I'm getting another error.

Java.Lang.IllegalAccessError:
 Class com.google.firebase.iid.zzb extended by class com.google.firebase.messaging.FirebaseMessagingService is inaccessible (declaration of 'com.google.firebase.messaging.FirebaseMessagingService' appears in /data/app/jp.co.myapp-R-G0SRwN2xxOaSLWjcpaMg==/base.apk)

I thought the following two dependencies were suspicious.

  • Xamarin.Firebase.Iid
  • Xamarin.Firebase.Iid.Interop

Xamarin.Firebase.Iid was referencing the latest version, but Xamarin.Firebase.Iid.Interop had a newer preview version.
So I installed 117.0.0-preview04 of Xamarin.Firebase.Iid.Interop directly.
No exception was raised! My app started correctly.

After that, I caused a deliberate crash, but the Crashlytics console does not appear ...
I know that Crashlytics can take quite some time to be reflected in the console. Watch the situation and report the results.

@a-imai exception you mentioned seems to be related to Firebase messaging package (Xamarin.Firebase.Messaging); perhaps older version?

With Crashlytics (117-preview2) I had a problem mentioned here: https://github.com/xamarin/XamarinComponents/issues/956#issuecomment-702037279

I did get reports appearing in Crashlytics console (and push notifications working) with these nugets:

<PackageReference Include="Plugin.FirebasePushNotification"> <Version>3.1.6</Version> </PackageReference> <PackageReference Include="Xamarin.Firebase.Analytics"> <Version>117.4.1-preview02</Version> </PackageReference> <PackageReference Include="Xamarin.Firebase.Crashlytics"> <Version>117.0.0-preview02</Version> </PackageReference> <PackageReference Include="Xamarin.Firebase.Messaging"> <Version>120.1.7-preview02</Version> </PackageReference> <PackageReference Include="Xamarin.Forms" Version="5.0.0.1487-pre1" /> <PackageReference Include="Xamarin.Essentials" Version="1.6.0-pre2" /> <PackageReference Include="Xamarin.Google.Android.DataTransport.TransportBackendCct"> <Version>2.2.2</Version> </PackageReference> <PackageReference Include="Xamarin.Google.Android.DataTransport.TransportRuntime"> <Version>2.2.2</Version> </PackageReference> <PackageReference Include="Xamarin.Google.Dagger"> <Version>2.25.2.1</Version> </PackageReference>

This worked for an already existing Firebase project (that was already working with Fabric API).

I have a problem with a newly created Firebase project; app starts, but I get this message in debug console: "E/FirebaseCrashlytics: Failed to retrieve settings from https://firebase-settings.crashlytics.com/spi/v2/platforms/android/gmp/XXXX/settings" (opening this link just returns and empty json).

Also in the Crashlytics console there is a message "Add the Firebase Android SDK (17.1.1 or higher) or Unity Plugin (6.15.0 or higher), then build, run, and crash your app". I'm mentioning this because Xamarin.Firebase.Crashlytics.117.0.0-preview02 is referencing SDK version 17.0.0.

@sasa-bobic In fact, I got another error when I tried the release build. Like, Mono.Cecil.Resolutionexception failed tp resolve Firebase.Iid.Zzb...
I investigated again and thought it was related to the Xamarin.Firebase.Messaging, same conclusion as you.
I'll put in Xamarin.Firebase.Messaging and pull out Xamarin.Firebase.Iid.Interop to try it out. I want to tell you the result at the beginning of the week.

Also in the Crashlytics console there is a message "Add the Firebase Android SDK (17.1.1 or higher) or Unity Plugin (6.15.0 or higher), then build, run, and crash your app". I'm mentioning this because Xamarin.Firebase.Crashlytics.117.0.0-preview02 is referencing SDK version 17.0.0.

Does this mean that I can't see the Crashlytics console using the Xamarin.Firebase.Crashlytics.117.0.0-preview02...?
If so, that's very bad news. I'm at a loss until November.
Also, where can I find the SDK version? Sorry for the rudimentary question...

@sasa-bobic I put in Xamarin.Firebase.Messaging, pulled out Xamarin.Firebase.Iid.Interop and tried to build.
The release build was fine, but the debug build failed.

/Users/.../myapp.Android/obj/Debug/googsvcsjson/values/goog_svcs_json.xml: Error APT2126: file not found. (APT2126) (myapp.Android)

I was getting a warning when I put in Xamarin.Firebase.Messaging, so I also put in Xamarin.Google.Android.DataTransport.TransportBackendCct and Xamarin.Google.Android.DataTransport.TransportRuntime to get rid of the warning.
At the moment, the package I put in Android project for Crashlytics looks like this:

<PackageReference Include="Xamarin.AndroidX.AppCompat.AppCompatResources" Version="1.1.0.1" />
<PackageReference Include="Xamarin.Firebase.Crashlytics">
  <Version>117.0.0-preview02</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.Dagger">
  <Version>2.25.2.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Messaging">
  <Version>120.1.7-preview02</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.Android.DataTransport.TransportBackendCct">
  <Version>2.2.2</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.Android.DataTransport.TransportRuntime">
  <Version>2.2.2</Version>
</PackageReference>

But still debug builds get the same error.
The release build succeeds, but even if crash the app, the console is still loading.

@sasa-bobic OK, sorry, the cause of my error was that I was renaming the folder in my workspace. It was a very trivial matter.
I deleted bin and obj and did clean. Now the debug build is successful.

So, the remaining problem is that the Crashlytics console is not displayed.
I suspect this issue is probably affecting me.
https://stackoverflow.com/a/63366092

This issue has been resolved thanks to @sasa-bobic, but I'm not sure until I see the crash on the console.
Leave it open for a while. I will always update the status depending on the situation.

My problem was that the Fabric settings remained in AndroidManifest.xml.
<meta-data android:name="firebase_crashlytics_collection_enabled" android:value="false" />
I removed this and ran it in a release build. The Firebase app, I've been using with Fabric, now successfully displays the crash log on the console.

However, in the newly created app, I get the same error as @sasa-bobic.
Failed to retrieve settings from https://firebase-settings.crashlytics.com/spi/v2/platforms/android/gmp/XXXX/settings
This problem still bothers me ...

anyway.
This issue has been resolved and I was able to get a crash log, albeit in a limited app.
I close the issue.

Hi,
I have documented the steps I did.
https://github.com/a-imai/XamarinCrashlyticsUpgradeSample
I really appreciate @sasa-bobic's advice!

It also describes how I dealt with the Failed to retrieve settings from ... error.
I'm still asking Google a question. I will update it when I get a reply, but I can't expect much.

I hope it helps someone.

@a-imai, thank you so much for your detailed description. It worked for me. Interestingly, I never was using Fabric or Firebase.Crash, but still ran into this problem. The reason why is because I was using Firebase.Messaging, and apparently that uses Firebase.Crashlytics under the hood. It's super annoying that it doesn't have its dependencies sufficient to handle all of this itself.

Was this page helpful?
0 / 5 - 0 ratings