priya_d
priya_d

Reputation: 403

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 

Upvotes: 3

Views: 2936

Answers (3)

sohail sk
sohail sk

Reputation: 41

check your project build output. Then you can find this System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

change it to shorth path Like C:\dev\project

Upvotes: 1

Ljupcho Hristov
Ljupcho Hristov

Reputation: 275

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.

Upvotes: 1

Avinash Roy
Avinash Roy

Reputation: 973

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.

Upvotes: 3

Related Questions