GooglePlayServicesComponents icon indicating copy to clipboard operation
GooglePlayServicesComponents copied to clipboard

Xamarin.Firebase.Messaging v120.1.0 (latest stable) NoSuchMethodError

Open rgajadin opened this issue 4 years ago • 18 comments

Java.Lang.NoSuchMethodError: 'No static method checkBuilderRequirement(Ljava/lang/Object;Ljava/lang/Class;)V 
in class Ldagger/internal/Preconditions; or its super classes (declaration of 'dagger.internal.Preconditions' appears in /data/app/com.tracefy-IBle5WlXG5aSWbYwJ8KFqA==/base.apk!classes2.dex)'

Just add Xamarin.Firebase.Messaging v120.1.0 to a project it should give above error during start

rgajadin avatar Oct 16 '20 08:10 rgajadin

repro sample please.

moljac avatar Oct 16 '20 10:10 moljac

Please be sure that R8 is not removing classes/methods.

Try adding proguard config file.... If not give me repro sample minimal, so I can bust some proguard.cfg

moljac avatar Oct 16 '20 10:10 moljac

This is my linker.config (it works on the previous version, on this version it doesn't work anymore)

<?xml version="1.0" encoding="utf-8"?>
<linker>
  <assembly fullname="Xamarin.AndroidX.AppCompat" ignoreIfMissing="1" />
  <assembly fullname="Xamarin.Firebase.Common" ignoreIfMissing="1" />
  <assembly fullname="Xamarin.Firebase.Iid" ignoreIfMissing="1" />
  <assembly fullname="Xamarin.Firebase.Iid.Interop" ignoreIfMissing="1" />
  <assembly fullname="Xamarin.Firebase.Measurement.Connector" ignoreIfMissing="1" />
  <assembly fullname="Xamarin.Firebase.Messaging" ignoreIfMissing="1" />
</linker>

PitaneMobility avatar Oct 16 '20 11:10 PitaneMobility

@moljac Here you go you have to add your own "google-services.json" and set the build action. Probably not that safe to add my own.

https://github.com/DarkSpikeX/test390

It's the default Visual Studio Android app template upgraded to AndroidX with Firebase messaging added to it

rgajadin avatar Oct 16 '20 12:10 rgajadin

linker.config != proguard.cfg

add your own "google-services.json" and set the build action. Probably not that safe to add my own.

True. Not safe to add your own

moljac avatar Oct 16 '20 13:10 moljac

I too have the same problem. Can anyone tell me how to solve it?

varshini862 avatar Oct 17 '20 07:10 varshini862

I too have the same problem. Can anyone tell me how to solve it?

For me, rolling back to 119.0.1 to get round the issue for now (even in debug which has limited linking) but I too would like to know how to resolve the linker issue.

Confusedfish avatar Oct 18 '20 12:10 Confusedfish

I too have the same problem. Can anyone tell me how to solve it?

@DarkSpikeX @varshini862 Installing Xamarin.Google.Dagger latest nugget version in the android project helped me solve Java.Lang.NoSuchMethodError: 'No static method checkBuilderRequirement(Ljava/lang/Object;Ljava/lang/Class;)V in class Ldagger/internal/Preconditions; or its super classes (declaration of 'dagger.internal.Preconditions' appears in /data/app/com.tracefy-IBle5WlXG5aSWbYwJ8KFqA==/base.apk!classes2.dex)'.

Link: https://www.nuget.org/packages/Xamarin.Google.Dagger/

gabrieldwight avatar Oct 19 '20 12:10 gabrieldwight

Seems like transitive dependencies pull in older Dagger packages

moljac avatar Oct 19 '20 12:10 moljac

Same issue here.

I did a rollback to v119 to "solve"... also tried @gabrieldwight 's procedure and it worked (!) but I rather avoid unnecessary (?) new dependencies in the project...

inimirpaz avatar Oct 19 '20 12:10 inimirpaz

latest nuget

https://www.nuget.org/packages/Xamarin.Google.Dagger/2.25.2.1

config.json

https://github.com/xamarin/GooglePlayServicesComponents/blob/master/config.json#L1096-L1103

		{
			"groupId" : "com.google.dagger",
			"artifactId" : "dagger",
			"version" : "2.25.2.1",
			"nugetVersion" : "2.25.2.1",
			"nugetId" : "Xamarin.Google.Dagger",
			"dependencyOnly" : true
		},

some other package references old Dagger.

moljac avatar Oct 19 '20 12:10 moljac

I downgrade to version 119.0.1 but the project can't compilele, giving the following message:

Severity Code Description Project File Line Suppression State Error System.IO.FileNotFoundException: Could not load assembly 'Xamarin.Firebase.Components, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile? File name: 'Xamarin.Firebase.Components.dll' at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) in /Users/builder/azdo/_work/287/s/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:line 241 at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference) in /Users/builder/azdo/_work/287/s/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:line 191 at Mono.Cecil.MetadataResolver.Resolve(TypeReference type) in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/cecil/Mono.Cecil/MetadataResolver.cs:line 110 at Mono.Cecil.TypeReference.Resolve() in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/cecil/Mono.Cecil/TypeReference.cs:line 276 at Mono.Linker.TypeReferenceExtensions.<GetMethods>d__4.MoveNext() at Mono.Linker.Steps.TypeMapStep.TryMatchMethod(TypeReference type, MethodReference method) at Mono.Linker.Steps.TypeMapStep.<GetBaseMethodsInInterfaceHierarchy>d__16.MoveNext() at Mono.Linker.Steps.TypeMapStep.MapVirtualInterfaceMethod(MethodDefinition method) at Mono.Linker.Steps.TypeMapStep.MapVirtualMethods(TypeDefinition type) at Mono.Linker.Steps.TypeMapStep.MapType(TypeDefinition type) at Mono.Linker.Steps.TypeMapStep.ProcessAssembly(AssemblyDefinition assembly) at Mono.Linker.Steps.BaseStep.Process(LinkContext context) at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step) at Mono.Linker.Pipeline.Process(LinkContext context) at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context) at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res) at Xamarin.Android.Tasks.LinkAssemblies.RunTask() at Xamarin.Android.Tasks.AndroidTask.Execute() FamStore.Android

with version 120.1.0 compile but the app crash after receive the notificacion.

d2ortiz avatar Oct 19 '20 22:10 d2ortiz

I downgrade to version 119.0.1 but the project can't compilele, giving the following message:

Severity Code Description Project File Line Suppression State Error System.IO.FileNotFoundException: Could not load assembly 'Xamarin.Firebase.Components, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile? File name: 'Xamarin.Firebase.Components.dll' at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) in /Users/builder/azdo/_work/287/s/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:line 241 at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference) in /Users/builder/azdo/_work/287/s/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:line 191 at Mono.Cecil.MetadataResolver.Resolve(TypeReference type) in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/cecil/Mono.Cecil/MetadataResolver.cs:line 110 at Mono.Cecil.TypeReference.Resolve() in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/cecil/Mono.Cecil/TypeReference.cs:line 276 at Mono.Linker.TypeReferenceExtensions.d__4.MoveNext() at Mono.Linker.Steps.TypeMapStep.TryMatchMethod(TypeReference type, MethodReference method) at Mono.Linker.Steps.TypeMapStep.d__16.MoveNext() at Mono.Linker.Steps.TypeMapStep.MapVirtualInterfaceMethod(MethodDefinition method) at Mono.Linker.Steps.TypeMapStep.MapVirtualMethods(TypeDefinition type) at Mono.Linker.Steps.TypeMapStep.MapType(TypeDefinition type) at Mono.Linker.Steps.TypeMapStep.ProcessAssembly(AssemblyDefinition assembly) at Mono.Linker.Steps.BaseStep.Process(LinkContext context) at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step) at Mono.Linker.Pipeline.Process(LinkContext context) at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context) at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res) at Xamarin.Android.Tasks.LinkAssemblies.RunTask() at Xamarin.Android.Tasks.AndroidTask.Execute() FamStore.Android

with version 120.1.0 compile but the app crash after receive the notificacion.

When you rollback, have you tried closing VS, deleting bin/obj folders across the projects in your solution then opening VS again and rebuilding the solution? It did the job for me.

inimirpaz avatar Oct 20 '20 06:10 inimirpaz

I am also facing the same issue, after update.

rkshnair avatar Oct 22 '20 07:10 rkshnair

Same here. Updated Xamarin.Firebase.Analytics and then on the first app start it always crashing.

SangI762 avatar Oct 22 '20 08:10 SangI762

Xamarin.Firebase.Messaging 120.1.7 not working still. Last known working version is 119.0.1 . Any news on the subject?

inimirpaz avatar Nov 10 '20 11:11 inimirpaz

@inimirpaz Like @gabrieldwight said installing the latest Xamarin.Google.Dagger fixes it for now and allows you to use the latest Xamarin.Firebase.Messaging

rgajadin avatar Nov 10 '20 11:11 rgajadin

Installing latest Xamarin.Google.Dagger package (version 2.27.0) indeed did fix the crash (I was seeing a NoClassDefFoundError but similar overall).

andrewleader avatar Jan 15 '21 07:01 andrewleader