You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@F-Goncalves I am seeing the same BINDINGSGENERATOR : error BG0000: System.NullReferenceException: Object reference not set to an instance of an object. error locally.
We might need to get help from @jpobst on that one, so you might need to add him to the private repo as well.
I think the NRE is the issue I found last week trying to bind the latest Google Material: dotnet/java-interop#1080
Due to the default includes in .NET SDK Style projects, you are trying to bind all 158 libraries in \JitsiLibs, which includes Google Material.
You can disable this with <EnableDefaultItems>false</EnableDefaultItems>.
Then you're down to only trying to incorrectly bind ~100 libraries in obj\Debug\net7.0-android\library_project_jars. I guess these come from the slim bindings something?
In short, I would highly recommend not trying to use slim bindings infrastructure.
I would suggest:
Create a binding project and add mylibrary-release.aar as an <AndroidLibrary>.
Add the Java dependencies that your library needs but shouldn't produce C# bindings as <AndroidLibrary Bind='false'>.
andersonvieiragomeslopes commented on Sep 25, 2023
Hello,
I hope I'm not late in the discussion, we are facing the same error with library bindings.
BINDINGSGENERATOR : error BG0000: System.NullReferenceException: Object reference not set to an instance of an object.
By insisting, we sometimes manage to generate the nuget package, but it breaks when trying to compile in a project, our project is public and we are using the azure communication services voip library.
I think the NRE is the issue I found last week trying to bind the latest Google Material: xamarin/java.interop#1080
Due to the default includes in .NET SDK Style projects, you are trying to bind all 158 libraries in \JitsiLibs, which includes Google Material.
You can disable this with <EnableDefaultItems>false</EnableDefaultItems>.
Then you're down to only trying to incorrectly bind ~100 libraries in obj\Debug\net7.0-android\library_project_jars. I guess these come from the slim bindings something?
In short, I would highly recommend not trying to use slim bindings infrastructure.
I would suggest:
Create a binding project and add mylibrary-release.aar as an <AndroidLibrary>.
Add the Java dependencies that your library needs but shouldn't produce C# bindings as <AndroidLibrary Bind='false'>.
I made progress when trying this, but I'm still stuck with another problem when trying to use the generated nuget package.
BINDINGSGENERATOR : error BG0000: System.NullReferenceException: Object reference not set to an instance of an object.
This is a generic error so there's a decent chance it isn't related to this issue.
I would suggest filing a new issue for this, ideally with:
Full stack trace of the exception
Sample product that produces this error
As for the runtime error, that should likely be a separate issue. Look at the output log to get the full text of the Java error. (You may need to bump up the logging verbosity to see it, not sure.)
andersonvieiragomeslopes commented on Sep 25, 2023
BINDINGSGENERATOR : error BG0000: System.NullReferenceException: Object reference not set to an instance of an object.
This is a generic error so there's a decent chance it isn't related to this issue.
I would suggest filing a new issue for this, ideally with:
Full stack trace of the exception
Sample product that produces this error
As for the runtime error, that should likely be a separate issue. Look at the output log to get the full text of the Java error. (You may need to bump up the logging verbosity to see it, not sure.)
It is an azure communication services library binding project, we are migrating to maui, but we came across the error below, this generic error that I mentioned was overcome, but I ran into another one later, to reproduce just add the package nuget that I generate in the link project in any example and build.
1>Exception in thread "main" java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net6.0-android33.0\lp\189\jl\libs\ED64959F88B22E6D.jar:com/google/gson/FieldNamingPolicy$5.class
1> at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:98)
1> at com.android.tools.r8.D8.main(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:4)
1>Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net6.0-android33.0\lp\189\jl\libs\ED64959F88B22E6D.jar:com/google/gson/FieldNamingPolicy$5.class
1> at Version.fakeStackEntry(Version_3.3.28.java:0)
1> at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:75)
1> at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:28)
1> at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:27)
1> at com.android.tools.r8.internal.Bj.b(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:2)
1> at com.android.tools.r8.D8.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:22)
1> at com.android.tools.r8.D8.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:17)
1> at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:85)
1> ... 1 more
1>Caused by: com.android.tools.r8.internal.f: Type com.google.gson.FieldNamingPolicy$5 is defined multiple times: obj\Debug\net6.0-android33.0\lp\189\jl\libs\ED64959F88B22E6D.jar:com/google/gson/FieldNamingPolicy$5.class, obj\Debug\net6.0-android33.0\lp\194\jl\libs\2C5D90B3B25D7C1F.jar:com/google/gson/FieldNamingPolicy$5.class
1> at com.android.tools.r8.internal.DT.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:14)
1> at com.android.tools.r8.internal.DT.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:22)
1> at com.android.tools.r8.internal.CN.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:33)
1> at com.android.tools.r8.internal.CN.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:10)
1> at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
1> at com.android.tools.r8.internal.CN.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:6)
1> at com.android.tools.r8.graph.B2$a.e(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:4)
1> at com.android.tools.r8.dex.b.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:105)
1> at com.android.tools.r8.dex.b.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:28)
1> at com.android.tools.r8.D8.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:25)
1> at com.android.tools.r8.D8.d(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:606)
1> at com.android.tools.r8.D8.c(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:1)
1> at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:24)
1> ... 5 more
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.509\tools\Xamarin.Android.D8.targets(79,5): error : java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net6.0-android33.0\lp\189\jl\libs\ED64959F88B22E6D.jar : com/google/gson/FieldNamingPolicy$5.class
1>Done building project "MauiApp9.csproj" -- FAILED.
@andersonvieiragomeslopes I think this last issue was due to gson being included by multiple sources(one of them being the bound library). Try 2.6.0-beta.5.4 and see if it works(You need to target at least net7, and I dont think you should explicitly reference gson). @jpobst I think the original issue is fixed.
Activity
jpobst commentedon Jan 2, 2023
If this is a binding project, you likely do not need for it to use AAPT:
https://github.com/xamarin/xamarin-android/blob/main/Documentation/guides/OneDotNetBindingProjects.md#resourcedesignercs
Try setting
<AndroidGenerateResourceDesigner>tofalseand see if that fixes it.F-Goncalves commentedon Jan 9, 2023
Unfortunately it makes no difference. Honestly I do not even have a clue what the .stamp files are used for.
jpobst commentedon Jan 10, 2023
@dellis1972 Seems like these
.stampfiles should not be passed toAAPT?F-Goncalves commentedon Jan 25, 2023
@dellis1972 @jpobst Any news on this?
dellis1972 commentedon Jan 25, 2023
@F-Goncalves can you share the Project? (or just even the csproj) It would help us repo the issue.
11 remaining items
F-Goncalves commentedon Jan 26, 2023
@dellis1972
Oh I see. I will push it.
F-Goncalves commentedon Jan 26, 2023
Done
F-Goncalves commentedon Feb 2, 2023
Hey @dellis1972,
it's been a while. Have you been able to compile the sample app?
dellis1972 commentedon Feb 6, 2023
@F-Goncalves I am seeing the same
BINDINGSGENERATOR : error BG0000: System.NullReferenceException: Object reference not set to an instance of an object.error locally.We might need to get help from @jpobst on that one, so you might need to add him to the private repo as well.
F-Goncalves commentedon Feb 6, 2023
@jpobst I invited you to the repo. Would be awesome if you could help here. Thanks in advance
jpobst commentedon Feb 6, 2023
I still get the original errors, was there a fix committed for them?
jpobst commentedon Feb 6, 2023
I think the NRE is the issue I found last week trying to bind the latest Google Material:
dotnet/java-interop#1080
Due to the default includes in .NET SDK Style projects, you are trying to bind all 158 libraries in
\JitsiLibs, which includes Google Material.You can disable this with
<EnableDefaultItems>false</EnableDefaultItems>.Then you're down to only trying to incorrectly bind ~100 libraries in
obj\Debug\net7.0-android\library_project_jars. I guess these come from the slim bindings something?In short, I would highly recommend not trying to use slim bindings infrastructure.
I would suggest:
mylibrary-release.aaras an<AndroidLibrary>.<AndroidLibrary Bind='false'>.andersonvieiragomeslopes commentedon Sep 25, 2023
Hello,
I hope I'm not late in the discussion, we are facing the same error with library bindings.
BINDINGSGENERATOR : error BG0000: System.NullReferenceException: Object reference not set to an instance of an object.
By insisting, we sometimes manage to generate the nuget package, but it breaks when trying to compile in a project, our project is public and we are using the azure communication services voip library.
https://github.com/Laerdal/Xamarin.AzureCommunicationCalling/tree/maui-beta/Bindings/Android/Laerdal.Maui.AzureCommunicationCalling.Android
@F-Goncalves were you able to find a solution to your problem?
andersonvieiragomeslopes commentedon Sep 25, 2023
I made progress when trying this, but I'm still stuck with another problem when trying to use the generated nuget package.
jpobst commentedon Sep 25, 2023
This is a generic error so there's a decent chance it isn't related to this issue.
I would suggest filing a new issue for this, ideally with:
As for the runtime error, that should likely be a separate issue. Look at the output log to get the full text of the Java error. (You may need to bump up the logging verbosity to see it, not sure.)
andersonvieiragomeslopes commentedon Sep 25, 2023
It is an azure communication services library binding project, we are migrating to maui, but we came across the error below, this generic error that I mentioned was overcome, but I ran into another one later, to reproduce just add the package nuget that I generate in the link project in any example and build.
1>Exception in thread "main" java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net6.0-android33.0\lp\189\jl\libs\ED64959F88B22E6D.jar:com/google/gson/FieldNamingPolicy$5.class
1> at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:98)
1> at com.android.tools.r8.D8.main(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:4)
1>Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net6.0-android33.0\lp\189\jl\libs\ED64959F88B22E6D.jar:com/google/gson/FieldNamingPolicy$5.class
1> at Version.fakeStackEntry(Version_3.3.28.java:0)
1> at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:75)
1> at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:28)
1> at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:27)
1> at com.android.tools.r8.internal.Bj.b(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:2)
1> at com.android.tools.r8.D8.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:22)
1> at com.android.tools.r8.D8.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:17)
1> at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:85)
1> ... 1 more
1>Caused by: com.android.tools.r8.internal.f: Type com.google.gson.FieldNamingPolicy$5 is defined multiple times: obj\Debug\net6.0-android33.0\lp\189\jl\libs\ED64959F88B22E6D.jar:com/google/gson/FieldNamingPolicy$5.class, obj\Debug\net6.0-android33.0\lp\194\jl\libs\2C5D90B3B25D7C1F.jar:com/google/gson/FieldNamingPolicy$5.class
1> at com.android.tools.r8.internal.DT.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:14)
1> at com.android.tools.r8.internal.DT.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:22)
1> at com.android.tools.r8.internal.CN.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:33)
1> at com.android.tools.r8.internal.CN.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:10)
1> at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
1> at com.android.tools.r8.internal.CN.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:6)
1> at com.android.tools.r8.graph.B2$a.e(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:4)
1> at com.android.tools.r8.dex.b.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:105)
1> at com.android.tools.r8.dex.b.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:28)
1> at com.android.tools.r8.D8.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:25)
1> at com.android.tools.r8.D8.d(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:606)
1> at com.android.tools.r8.D8.c(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:1)
1> at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:24)
1> ... 5 more
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.509\tools\Xamarin.Android.D8.targets(79,5): error : java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net6.0-android33.0\lp\189\jl\libs\ED64959F88B22E6D.jar : com/google/gson/FieldNamingPolicy$5.class
1>Done building project "MauiApp9.csproj" -- FAILED.
My nuget package
<PackageReference Include="Laerdal.Maui.AzureCommunicationHelper.android"> <Version>2.5.1-beta.3.2</Version> </PackageReference> <PackageReference Include="Xamarin.Android.Volley"> <Version>1.2.1.5</Version> </PackageReference> <PackageReference Include="Xamarin.AndroidX.Activity"> <Version>1.7.2.2</Version> </PackageReference> <PackageReference Include="Xamarin.AndroidX.Activity.Ktx"> <Version>1.7.2.2</Version> </PackageReference> <PackageReference Include="Xamarin.AndroidX.AppCompat"> <Version>1.6.1.4</Version> </PackageReference> <PackageReference Include="Xamarin.AndroidX.Lifecycle.Common"> <Version>2.6.2.1</Version> </PackageReference> <PackageReference Include="Xamarin.AndroidX.Lifecycle.Common.Java8"> <Version>2.6.2.1</Version> </PackageReference> <PackageReference Include="GoogleGson"> <Version>2.10.1.5</Version> </PackageReference> <PackageReference Include="Xamarin.AndroidX.Core" Version="1.12.0.1" /> <PackageReference Include="Xamarin.AndroidX.Camera.Lifecycle" Version="1.2.3.2" /> <PackageReference Include="Xamarin.AndroidX.Camera.Camera2" Version="1.2.3.2" /> <PackageReference Include="Xamarin.AndroidX.Camera.View" Version="1.2.3.2" /> <PackageReference Include="Xamarin.AndroidX.Lifecycle.Common" Version="2.6.2.1" /> <PackageReference Include="Xamarin.AndroidX.Preference"> <Version>1.2.1.1</Version> </PackageReference> <PackageReference Include="Xamarin.AndroidX.Work.Runtime"> <Version>2.8.1.4</Version> </PackageReference> <PackageReference Include="Xamarin.Google.Guava.ListenableFuture" Version="1.0.0.15" /> <PackageReference Include="Xamarin.AndroidX.Concurrent.Futures" Version="1.1.0.15" /> <PackageReference Include="Xamarin.GooglePlayServices.Base"> <Version>118.2.0.2</Version> </PackageReference>tompi commentedon Dec 18, 2023
@andersonvieiragomeslopes I think this last issue was due to gson being included by multiple sources(one of them being the bound library). Try 2.6.0-beta.5.4 and see if it works(You need to target at least net7, and I dont think you should explicitly reference gson). @jpobst I think the original issue is fixed.
jpobst commentedon Mar 20, 2024
🎉