Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error JAVA0000 when upgrading to 118.2.0.4 #825

Open
williambuchanan2 opened this issue Dec 6, 2023 · 8 comments
Open

Error JAVA0000 when upgrading to 118.2.0.4 #825

williambuchanan2 opened this issue Dec 6, 2023 · 8 comments

Comments

@williambuchanan2
Copy link

Xamarin.Android Version (eg: 6.0):

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

Windows

Google Play Services Version

118.2.0.4

  • [] GPS-FB with AndroidX dependencies (versions 1xx.yyyy.zz)

  • [] GPS-FB with Android.Support (legacy) dependencies (versions 71.yyyy.zz)

Describe your Issue

Get a build error:

Error JAVA0000
Error in C:\Ws_ng\xamarin.androidx.collection.jvm\1.3.0.1\buildTransitive\net6.0-android31.0....\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArraySetKt.class

Relevant information

Building .NET Maui app in Visual Studio. Worked ok in earlier version. Problem exists in .NET 7 and .NET 8.

Add relevant project settings from *.csproj file:

Packages used:

		<PackageReference Include="Xamarin.GooglePlayServices.Base" Version="118.2.0.4"/>
		<PackageReference Include="Xamarin.GooglePlayServices.Basement" Version="118.2.0.4"/>

		<PackageReference Include="Xamarin.AndroidX.Activity" Version="1.8.0.1" />
		<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.8.0.1" />

Build settings (tools)

    <AndroidDexTool>d8</AndroidDexTool>
    <AndroidLinkTool>r8</AndroidLinkTool>
    <AndroidUseAapt2>true</AndroidUseAapt2>
    <AndroidEnableDesugar>true</AndroidEnableDesugar>

or even better - links to the existing code:

NOTE: Please DO NOT submit screenshot images. Images are not searchable!

Minimal Repro Code Sample

If you want to speed up investigation and bug fixing: please provide minimal repro sample for tests.

Steps to Reproduce (with link to sample solution if possible):

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

@hellcoderGIT
Copy link

hellcoderGIT commented Dec 13, 2023

seeing the same error, 118.4.3 is the last working one, 118.4.3.1, 118.5.1 and 118.5.1.1 throw this error.
(Maui - net8-android)

@moljac
Copy link
Member

moljac commented Jan 15, 2024

@williambuchanan2 @hellcoderGIT

Thanks for the feedback. Can you provide minimal repro sample please?

And lucky shot attempt:

try adding

<PackageReference Include="Xamarin.AndroidX.Collection.Jvm" Version="1.3.0.2" />

@williambuchanan2
Copy link
Author

try adding

<PackageReference Include="Xamarin.AndroidX.Collection.Jvm" Version="1.3.0.2" />

@moljac

I added that but it didn't work. In fact it just caused another build problem.

Error JAVA0000 Error in C:\Ws_ng\xamarin.androidx.collection.ktx\1.2.0.9\buildTransitive\net6.0-android31.0....\jar\androidx.collection.collection-ktx.jar:androidx/collection/ArrayMapKt.class:
Type androidx.collection.ArrayMapKt is defined multiple times

@hellcoderGIT
Copy link

adding Xamarin.AndroidX.Collection(.Ktx) fixed it for me:

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'"> <PackageReference Include="Xamarin.AndroidX.Collection"> <Version>1.3.0.2</Version> </PackageReference> <PackageReference Include="Xamarin.AndroidX.Collection.Ktx"> <Version>1.3.0.2</Version> </PackageReference> <PackageReference Include="Xamarin.Firebase.Analytics"> <Version>121.3.0.4</Version> </PackageReference> <PackageReference Include="Xamarin.Firebase.Crashlytics"> <Version>118.5.1.1</Version> </PackageReference> </ItemGroup>

@williambuchanan2
Copy link
Author

Well done @hellcoderGIT !

It looks like nuget doesn't realise those dependencies are required. I had to add this in to my project and then manually update the version number in the csproj files because nuget was failing to do that as well.

        <PackageReference Include="Xamarin.AndroidX.Collection"><Version>1.3.0.2</Version></PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Collection.Ktx"><Version>1.3.0.2</Version></PackageReference>

@moljac
Copy link
Member

moljac commented Feb 14, 2024

I added that but it didn't work.

Possibly. It transitive depends on ALL depenencies of ALL PackageReferences in your project. It gets worse with 3rd party packages (like plugins) which are not updated regularly.

The problem is that google moves types from artifact to artifact in different versions.

This issue will give you more insights into the problem

xamarin/AndroidX#764

In fact it just caused another build problem.

Error JAVA0000 Error in C:\Ws_ng\xamarin.androidx.collection.ktx\1.2.0.9\buildTransitive\net6.0-android31.0....\jar\androidx.collection.collection-ktx.jar:androidx/collection/ArrayMapKt.class: Type androidx.collection.ArrayMapKt is defined multiple times

No. It is the same problem, but different nuget constellation.

@moljac
Copy link
Member

moljac commented Feb 14, 2024

Well done @hellcoderGIT !

maybe his app was a bit less complex and that simple trick worked.

It looks like nuget doesn't realise those dependencies are required.

Nuget does realise and if you check dependency tree you will see that those are referenced. It could be that there is 2+ versions of the same package.

I had to add this in to my project and then manually update the version number in the csproj files because nuget was failing to do that as well.

Again. Nuget does everything right. What you did is - you actually told nuget to forget all other packages and override them with versions you specified - (explicit reference).

        <PackageReference Include="Xamarin.AndroidX.Collection"><Version>1.3.0.2</Version></PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Collection.Ktx"><Version>1.3.0.2</Version></PackageReference>

Did this addition help?

@williambuchanan2
Copy link
Author

Again. Nuget does everything right. What you did is - you actually told nuget to forget all other packages and override them with versions you specified - (explicit reference).
Did this addition help?

Not sure I understand what you are saying. From my perspective Nuget should just work. I shouldn't need to manually edit files. In this case Nuget wasn't working. It wasn't including the dependencies. I didn't exclude anything - it just didn't work.

In fact the same problem occurred yesterday with the latest AndroidX packages. Same thing again - Nuget was failing to update them so I had to manually edit the csproj.

If you can see that I have done something to cause that let me know - but as I said I expect it to just work without me needing to do extra work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants