Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error:The "GenerateJavaStubs" task failed unexpectedly

after installing plugin.media library getting this error

Severity    Code    Description Project File    Line    Suppression State Error     The "GenerateJavaStubs" task failed unexpectedly. System.InvalidOperationException: There can be only one type with an [Application] attribute; found: ,at Xamarin.Android.Tasks.ManifestDocument.CreateApplicationElement(XElement manifest, String applicationClass, List`1 subclasses, List`1 selectedWhitelistAssemblies)at Xamarin.Android.Tasks.ManifestDocument.Merge(List`1 subclasses, List`1 selectedWhitelistAssemblies, String applicationClass, Boolean embed, String bundledWearApplicationName, IEnumerable`1 mergedManifestDocuments)at Xamarin.Android.Tasks.GenerateJavaStubs.Run(DirectoryAssemblyResolver res)at Xamarin.Android.Tasks.GenerateJavaStubs.Execute()at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() XamarinForms.QbChat.Android 
like image 341
priya_d Avatar asked Nov 27 '25 23:11

priya_d


2 Answers

This plugin depends on https://github.com/jamesmontemagno/CurrentActivityPlugin

The Current Activity plugin adds an Application class to your Android project. Make sure there's only one Application class and attribute in your Android project.

like image 89
Avinash Roy Avatar answered Nov 29 '25 11:11

Avinash Roy


Some plugins as plugin.media, DeviceInfo, CurrentActivity etc. are adding MainApplication.cs that contains MainActivity winch conflict with MainActivity that is already there.

To resolve delete MainApplication.cs.

like image 43
Ljupcho Hristov Avatar answered Nov 29 '25 12:11

Ljupcho Hristov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!