xamarin / GooglePlayServicesComponents

Other
316 stars 147 forks source link

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

Open rgajadin opened 4 years ago

rgajadin commented 4 years ago
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

moljac commented 4 years ago

repro sample please.

moljac commented 4 years ago

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

PitaneMobility commented 4 years ago

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>
rgajadin commented 4 years ago

@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

moljac commented 4 years ago

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

varshini862 commented 4 years ago

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

Confusedfish commented 4 years ago

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.

gabrieldwight commented 4 years ago

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/

moljac commented 4 years ago

Seems like transitive dependencies pull in older Dagger packages

inimirpaz commented 4 years ago

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...

moljac commented 4 years ago

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.

d2ortiz commented 4 years ago

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.d4.MoveNext() at Mono.Linker.Steps.TypeMapStep.TryMatchMethod(TypeReference type, MethodReference method) at Mono.Linker.Steps.TypeMapStep.d16.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.

inimirpaz commented 4 years ago

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.d4.MoveNext() at Mono.Linker.Steps.TypeMapStep.TryMatchMethod(TypeReference type, MethodReference method) at Mono.Linker.Steps.TypeMapStep.d16.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.

rkshnair commented 4 years ago

I am also facing the same issue, after update.

SangI762 commented 4 years ago

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

inimirpaz commented 3 years ago

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

rgajadin commented 3 years ago

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

andrewleader commented 3 years ago

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