[英]Why am I getting JINativeWrapper.g.cs file not found error when running my Xamarin app?
When I try to run my Xamarin app on my M1 MacBook, it builds and works fine.当我尝试在我的 M1 MacBook 上运行我的 Xamarin 应用程序时,它构建并运行良好。 But when I run this function:
但是当我运行这个函数时:
async void loginHandler()
{
var loginText = login.Text;
var passwordText = password.Text;
var client = new HttpClient();
var json = new StringContent(
JsonConvert.SerializeObject(new { username = loginText, password = passwordText })
);
var result = await client.PostAsync("https://localhost:443/api/account/login", json);
if (result.IsSuccessStatusCode)
{
var TokenJson = await result.Content.ReadAsStringAsync();
//await DisplayAlert("alert", "message", "cancel");
}
}
It crashes and shows this error:它崩溃并显示此错误:
How can I fix it?我该如何解决? I'm using visual studio 2022.
我正在使用视觉工作室 2022。
Try using an iOS emulator.尝试使用 iOS 模拟器。 Seems like Visual Studio needs to fix this problem with android emulators.
似乎 Visual Studio 需要用 android 模拟器解决这个问题。
For me, my VS2022 instance was pointing to version 8 of the JDK.对我来说,我的 VS2022 实例指向 JDK 的 8 版。 My Android app is targeting Android 12 (SDK 31).
我的 Android 应用程序面向 Android 12 (SDK 31)。 Once I updated my JDK to 17 (or 11+) I was no longer getting the error.
将 JDK 更新到 17(或 11+)后,我不再收到错误消息。 Not sure if that will help anyone or not, but that is what worked for me.
不确定这是否会帮助任何人,但这对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.