Closed mattleibow closed 1 year ago
Issue moved from dotnet/maui#9413
From @MagicAndre1981 on Sunday, August 14, 2022 12:03:24 PM
does it happen without using IKVM.Maven.Sdk and direct maven packages? Try to use only the official AndroidX bindings.
Issue moved from dotnet/maui#9413
From @martin-honnen on Sunday, August 14, 2022 12:19:03 PM
@MagicAndre1981, I am not sure I understand how your suggestion helps. The used NuGet package IKVM.Maven.Sdk allows me to use Java packages from Maven under .NET, at least tested so far successfully on Windows. How would an official "AndroidX" binding help or work to run Java code from .NET on various platforms including Windows and Android (and IOs and MacOS via MacCatalyst), as MAUI promises? Or is that "use only the official AndroidX bindings" you are referring to something that works across platforms with MAUI?
It looks like the library you are trying to use requires features that aren't supported on earlier versions of Android:
MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)]
Try setting your Android <SupportedOSPlatformVersion>
to 26.0:
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
It looks like I am expecting too much I guess, it is true that using a higher version of Android avoids that compilation error but nevertheless I am running into further problems, now with all components (.NET 7) and libraries updated to their latest version, the app runs fine on Windows but the app starts on Android (Android emulator Pixel 5 - API 33 (Android 13.0) on Windows 11) with the splash screen to then show the error:
System.Reflection.TargetInvocationException
Nachricht = Exception has been thrown by the target of an invocation.
0xFFFFFFFFFFFFFFFF in Android.Runtime.JNIEnv.monodroid_debugger_unhandled_exception C#
0x1A in Android.Runtime.JNINativeWrapper._unhandled_exception at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:12,5 C#
0x23 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:353,26 C#
0x29 in System.Reflection.ConstructorInvoker.InterpretedInvoke C#
0x4 in System.Reflection.ConstructorInvoker.InlinedInvoke C#
0xBD in System.RuntimeType.CreateInstanceMono C#
0x1F in System.RuntimeType.CreateInstanceDefaultCtor C#
0x30 in System.Activator.CreateInstance C#
0x3 in System.Activator.CreateInstance C#
0x2 in System.Activator.CreateInstance C#
0x48 in Microsoft.Maui.Controls.ShellContent. at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellContent.cs:75,8 C#
0x27 in Microsoft.Maui.Controls.ElementTemplate.CreateContent at D:\a\_work\1\s\src\Controls\src\Core\ElementTemplate.cs:85,4 C#
0x8 in Microsoft.Maui.Controls.Internals.DataTemplateExtensions.CreateContent at D:\a\_work\1\s\src\Controls\src\Core\DataTemplateExtensions.cs:22,4 C#
0x77 in Microsoft.Maui.Controls.ShellContent.Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent at D:\a\_work\1\s\src\Controls\src\Core\Shell\ShellContent.cs:80,5 C#
0x16E in Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRenderer.OnCreateView at D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ShellSectionRenderer.cs:123,5 C#
0x24 in AndroidX.Fragment.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ at /Users/runner/work/1/s/generated/androidx.fragment.fragment/obj/Release/net6.0-android/generated/src/AndroidX.Fragment.App.Fragment.cs:2031,4 C#
0xD in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:352,5 C#
Current test project is at https://github.com/martin-honnen/SaxonHEMauiNET7Test1.
Tested with
Microsoft Visual Studio Community 2022
Version 17.4.4
VisualStudio.17.Release/17.4.4+33213.308
Microsoft .NET Framework
Version 4.8.09032
Installierte Version: Community
Visual C++ 2022 00482-90000-00000-AA069
Microsoft Visual C++ 2022
ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools
Allgemeine Azure-Tools 1.10
Bietet allgemeine Dienste für die Verwendung durch Azure Mobile Services und Microsoft Azure-Tools.
ASA Service Provider 1.0
ASP.NET and Web Tools 17.4.326.54890
ASP.NET and Web Tools
Azure App Service-Tools v3.0.0 17.4.326.54890
Azure App Service-Tools v3.0.0
Azure Data Lake Tools for Visual Studio 2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio
Azure Functions and Web Jobs Tools 17.4.326.54890
Azure Functions and Web Jobs Tools
Azure Stream Analytics Tools for Visual Studio 2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio
C#-Tools 4.4.0-6.22608.27+af1e46ad38d900023f8b1a2839484e471ece1502
C#-Komponenten, die in der IDE verwendet werden. Abhängig von Ihrem Projekttyp und den zugehörigen Einstellungen kann eine andere Version des Compilers verwendet werden.
Cookiecutter 17.0.22263.6
Stellt Tools zum Suchen, Instanziieren und Anpassen von Vorlagen im Cookiecutter-Format bereit.
Extensibility Message Bus 1.4.1 (main@2ee106a)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
Microsoft Azure-Tools für Visual Studio 2.9
Support für Azure Cloud Services-Projekte
Microsoft Azure Hive Query Language Service 2.6.5000.0
Language service for Hive query
Microsoft Azure Stream Analytics Language Service 2.6.5000.0
Language service for Azure Stream Analytics
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 17.4.19 (8c0a575)
Support for debugging Mono processes with Visual Studio.
Node.js-Tools 1.5.40817.1 Commit Hash:66443775f9f3b1d8f8fee47af5002828b346688d
Fügt Unterstützung für das Entwickeln und Debuggen von Node.js-Apps in Visual Studio hinzu
NuGet-Paket-Manager 6.4.0
NuGet-Paket-Manager in Visual Studio. Weitere Informationen zu NuGet finden Sie unter https://docs.nuget.org/.
Python – Unterstützung für die Profilerstellung 17.0.22263.6
Profilerstellungsunterstützung für Python-Projekte.
Python mit Pylance 17.0.22263.6
Stellt IntelliSense, Projekte, Vorlagen, Debuggen, interaktive Fenster und weitere Unterstützung für Python-Entwickler bereit.
Razor (ASP.NET Core) 17.0.0.2246202+61cc048d36a3fc9246d2f04625988b19a18ab8f0
Stellt Sprachdienste für ASP.NET Core Razor bereit.
SQL Server Data Tools 17.0.62207.28050
Microsoft SQL Server Data Tools
Syntax Visualizer 1.0
An extension for visualizing Roslyn SyntaxTrees.
Testadapter für Boost.Test 1.0
Aktiviert Visual Studio-Testtools mit Komponententests, die für Boost.Test geschrieben wurden. Nutzungsbedingungen und Drittanbieterhinweise stehen im Installationsverzeichnis der Erweiterung zur Verfügung.
Testadapter für Google Test 1.0
Ermöglicht die Verwendung von Visual Studio-Testtools mit Komponententests, die für Google Test geschrieben wurden. Die Nutzungsbedingungen und Drittanbieterhinweise stehen im Installationsverzeichnis der Erweiterung zur Verfügung.
ToolWindowHostedEditor 1.0
Hosting json editor into a tool window
TypeScript-Tools 17.0.10921.2001
TypeScript-Tools für Microsoft Visual Studio
Visual Basic-Tools 4.4.0-6.22608.27+af1e46ad38d900023f8b1a2839484e471ece1502
Visual Basic-Komponenten, die in der IDE verwendet werden. Abhängig von Ihrem Projekttyp und den zugehörigen Einstellungen kann eine andere Version des Compilers verwendet werden.
Visual F# Tools 17.4.0-beta.22512.4+525d5109e389341bb90b144c24e2ad1ceec91e7b
Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2
KI-gestützte Entwicklung für Visual Studio.
VisualStudio.DeviceLog 1.0
Informationen zum Paket
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
VSPackage-Erweiterung 1.0
Detaillierte Informationen zur VSPackage Visual Studio-Erweiterung
Xamarin 17.4.0.312 (d17-4@be7e8d1)
Visual Studio-Erweiterung, um Entwicklung für Xamarin.iOS und Xamarin.Android zu ermöglichen.
Xamarin Designer 17.4.0.138 (remotes/origin/d17-4@d36bba3cc9)
Visual Studio-Erweiterung zum Aktivieren der Xamarin Designer-Tools in Visual Studio.
Xamarin Templates 17.4.2 (c457c97)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 13.1.0.1 (d17-4/13ba222)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: a96bde9
Java.Interop: xamarin/java.interop/d17-4@fcc33ce2
SQLite: xamarin/sqlite/3.39.3@23e1ae7
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@0be567a
Xamarin.iOS and Xamarin.Mac SDK 16.1.1.27 (933c6c2c9)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
This looks like a new, different error that is likely a MAUI issue.
I would suggest filing this as a new error in the MAUI repository so they can take a look at it: https://github.com/dotnet/maui
Issue moved from dotnet/maui#9413
From @martin-honnen on Sunday, August 14, 2022 9:32:45 AM
Description
I have tried to write a .NET 6 MAUI app with VS 2022 17.3, the app builds/compiles/runs fine on Windows but when trying to run it on an Android emulator all I get is an error
Example is in the Github repository https://github.com/martin-honnen/SaxonHEMauiTest1.
Steps to Reproduce
java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: Ljava/lang/invoke/MethodHandleImpl$BindCaller$T;invoke_V(Ljava/lang/invoke/MethodHandle;[Ljava/lang/Object;)Ljava/lang/Object;, origin: obj\Debug\net6.0-android\lp\157\jl\resources.jar : java/lang/invoke/MethodHandleImpl$BindCaller$T.class SaxonHEMauiTest1 C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.448\tools\Xamarin.Android.D8.targets 79
Version with bug
6.0.400
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 12.1 API 32, Android 11 API 30
Did you find any workaround?
No, I don't know how to resolve this.
Relevant log output