Whenever I deploy my .NET MAUI application to my Android phone, it exits the code, producing an error "GetVersionTask" failed unexpectedly". What could be the solutions for this?
Whenever I deploy my application to my Android phone, it produces the error called
""GetVersionTask" failed unexpectedly." When I run it using Windows Machine, it runs completely normal. What could be the solution to this?
Visual Studio
.NET MAUI
-
Leon Lu (Shanghai Wicresoft Co,.Ltd.) 77,181 Reputation points • Microsoft Vendor
2024-05-13T06:18:38.56+00:00 Do you debug your application with VS?
Or do you release application, then generate .aab or .apk file, install .aab or .apk file in you android phone?
it produces the error called ""GetVersionTask" failed unexpectedly."
Where did you get this error? From VS output error or other places.
You can try to deploy your application to android emulator, is that working?
-
John Ivan D. Bachiller 0 Reputation points
2024-05-13T14:07:41.1133333+00:00 Yes, I do debug my application with Visual Studio. Slight correction, "VerifyVersionTask" is what's appearing as an error when I debug it and try to release it on my Android phone.
-
Leon Lu (Shanghai Wicresoft Co,.Ltd.) 77,181 Reputation points • Microsoft Vendor
2024-05-14T05:48:17.5+00:00 Did you try to debug it in your Android emulator? If you can debug it in your android emulator, this issue is related to your Android phone. If not, please copy your .csproj file here. I will try to reproduce this issue. Please share your VS version as well.
-
John Ivan D. Bachiller 0 Reputation points
2024-05-18T05:59:52.0533333+00:00 It doesn't let me upload the csproj file here. But here's the whole code.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <TargetFrameworks>net8.0-ios;net8.0-maccatalyst;net8.0-android34.0</TargetFrameworks> <!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET --> <!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> --> <!-- Note for MacCatalyst: The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64. When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>. The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated; either BOTH runtimes must be indicated or ONLY macatalyst-x64. --> <!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> --> <OutputType>Exe</OutputType> <RootNamespace>MobileApplication</RootNamespace> <UseMaui>true</UseMaui> <SingleProject>true</SingleProject> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <!-- Display name --> <ApplicationTitle>MobileApplication</ApplicationTitle> <!-- App Identifier --> <ApplicationId>com.companyname.mobileapplication</ApplicationId> <!-- Versions --> <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> <ApplicationVersion>1</ApplicationVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">31.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion> <TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-windows10.0.19041.0|AnyCPU'"> <NoWarn>1701;1702</NoWarn> <Optimize>True</Optimize> <DebugType>portable</DebugType> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-windows10.0.19041.0|AnyCPU'"> <NoWarn>1701;1702</NoWarn> <DebugType>portable</DebugType> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android|AnyCPU'"> <EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk> <AndroidEnableMultiDex>True</AndroidEnableMultiDex> <AndroidCreatePackagePerAbi>True</AndroidCreatePackagePerAbi> <Optimize>True</Optimize> <DebugType>portable</DebugType> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android|AnyCPU'"> <AndroidEnableMultiDex>True</AndroidEnableMultiDex> <AndroidCreatePackagePerAbi>True</AndroidCreatePackagePerAbi> <DebugType>portable</DebugType> </PropertyGroup> <PropertyGroup> <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks> <PlatformTarget>AnyCPU</PlatformTarget> <ProduceReferenceAssembly>False</ProduceReferenceAssembly> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'"> <Optimize>True</Optimize> <DebugType>portable</DebugType> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-maccatalyst|AnyCPU'"> <Optimize>True</Optimize> <DebugType>portable</DebugType> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'"> <DebugType>portable</DebugType> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-maccatalyst|AnyCPU'"> <DebugType>portable</DebugType> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android34.0|AnyCPU'"> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <!-- App Icon --> <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" /> <!-- Splash Screen --> <MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" /> <!-- Images --> <MauiImage Include="Resources\Images\*" /> <!-- Custom Fonts --> <MauiFont Include="Resources\Fonts\*" /> <!-- Raw Assets (also remove the "Resources\Raw" prefix) --> <MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" /> </ItemGroup> <ItemGroup> <None Remove="Resources\Images\dashboard.png" /> <None Remove="Resources\Images\email.png" /> <None Remove="Resources\Images\history.png" /> <None Remove="Resources\Images\logo.png" /> <None Remove="Resources\Images\notification.png" /> <None Remove="Resources\Images\password.png" /> <None Remove="Resources\Images\search.png" /> <None Remove="Resources\Images\user.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0" /> <PackageReference Include="Microsoft.Identity.Client" Version="4.61.0" /> <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.40" /> <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.40" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" /> <PackageReference Include="MongoDB.Bson" Version="2.25.0" /> <PackageReference Include="MongoDB.Driver" Version="2.25.0" /> <PackageReference Include="MongoDB.Driver.Core" Version="2.25.0" /> <PackageReference Include="MySql.Data" Version="8.4.0" /> <PackageReference Include="System.Drawing.Common" Version="8.0.5" /> <PackageReference Include="ZXing.Net" Version="0.16.9" /> <PackageReference Include="ZXing.Net.Mobile" Version="2.4.1" /> </ItemGroup> <ItemGroup> <MauiXaml Update="ChangePasswordPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="DashboardPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="GenerateQRPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="HistoryPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="ItemDetailPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="LogoutPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="ManualInputPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="NotificationDetailPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="NotificationPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> <MauiXaml Update="SearchPage.xaml"> <Generator>MSBuild:Compile</Generator> </MauiXaml> </ItemGroup> <ItemGroup> <None Update="BookQuery.sql"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> <None Update="DatabaseQuery.sql"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'"> <PackageReference Include="Xamarin.Android.Support.Annotations"> <Version>28.0.0.1</Version> </PackageReference> <PackageReference Include="Xamarin.Android.Support.Compat"> <Version>28.0.0.1</Version> </PackageReference> <PackageReference Include="Xamarin.Android.Support.Core.Utils"> <Version>28.0.0.1</Version> </PackageReference> <PackageReference Include="Xamarin.Android.Support.v4"> <Version>28.0.0.1</Version> </PackageReference> <PackageReference Include="Xamarin.Android.Support.VersionedParcelable"> <Version>28.0.0.1</Version> </PackageReference> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android34.0'"> <PackageReference Include="Xamarin.Android.Support.Annotations"> <Version>28.0.0.1</Version> </PackageReference> <PackageReference Include="Xamarin.Android.Support.v4"> <Version>28.0.0.1</Version> </PackageReference> </ItemGroup>
</Project>
-
Leon Lu (Shanghai Wicresoft Co,.Ltd.) 77,181 Reputation points • Microsoft Vendor
2024-05-21T05:39:40.6766667+00:00 Please change the
net8.0-android34
to thenet8.0-android
in<TargetFrameworks>
, if you use the latest .net version, android target-framework version will be set android 34 automatically.
Sign in to comment