MAUI: Can't rebuild the app in release mode due to unknown errors
I am getting below errors when try to rebuild my MAUI app in release mode.
Severity Code Description Project File Line Suppression State
Error MSB4064 The "AndroidFixManifests" parameter is not supported by the "XamarinDownloadArchives" task loaded from assembly: Xamarin.Build.Download, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null from the path: C:\Users\MyName.nuget\packages\xamarin.build.download\0.11.4\buildTransitive\Xamarin.Build.Download.dll. Verify that the parameter exists on the task, the <UsingTask> points to the correct assembly, and it is a settable public instance property. MyProjectName C:\Users\MyName.nuget\packages\xamarin.build.download\0.11.0\buildTransitive\Xamarin.Build.Download.targets 60 Severity Code Description Project File Line Suppression State Error MSB4063 The "XamarinDownloadArchives" task could not be initialized with its input parameters. MyProjectName C:\Users\MyName.nuget\packages\xamarin.build.download\0.11.0\buildTransitive\Xamarin.Build.Download.targets 52 Severity Code Description Project File Line Suppression State Error MSB3030 Could not copy the file "C:\Users\MyName.nuget\packages\xamarin.firebase.ios.cloudfirestore\8.10.0.3\lib\net6.0-ios15.4\Firebase.CloudFirestore.resources\grpc.xcframework\ios-arm64\grpc.framework\PrivateHeaders\src\core\ext\filters\client_channel\lb_policy\grpclb\client_load_reporting_filter.h" because it was not found. MyProjectName C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets 4911 Severity Code Description Project File Line Suppression State Error MSB3027 Could not copy "C:\Users\MyName.nuget\packages\xamarin.firebase.ios.cloudfirestore\8.10.0.3\lib\net6.0-ios15.4\Firebase.CloudFirestore.resources\grpc.xcframework\ios-arm64\grpc.framework\PrivateHeaders\src\core\ext\filters\client_channel\lb_policy\child_policy_handler.h" to "bin\Release\net7.0-ios\iossimulator-x64\Firebase.CloudFirestore.resources\grpc.xcframework\ios-arm64\grpc.framework\PrivateHeaders\src\core\ext\filters\client_channel\lb_policy\child_policy_handler.h". Exceeded retry count of 10. Failed. MyProjectName C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets 4911 Severity Code Description Project File Line Suppression State Error MSB3021 Unable to copy file "C:\Users\MyName.nuget\packages\xamarin.firebase.ios.cloudfirestore\8.10.0.3\lib\net6.0-ios15.4\Firebase.CloudFirestore.resources\grpc.xcframework\ios-arm64\grpc.framework\PrivateHeaders\src\core\ext\upb-generated\src\proto\grpc\lb\v1\load_balancer.upb.h" to "bin\Release\net7.0-ios\iossimulator-x64\Firebase.CloudFirestore.resources\grpc.xcframework\ios-arm64\grpc.framework\PrivateHeaders\src\core\ext\upb-generated\src\proto\grpc\lb\v1\load_balancer.upb.h". Could not find a part of the path 'bin\Release\net7.0-ios\iossimulator-x64\Firebase.CloudFirestore.resources\grpc.xcframework\ios-arm64\grpc.framework\PrivateHeaders\src\core\ext\upb-generated\src\proto\grpc\lb\v1\load_balancer.upb.h'. MyProjectName C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets 4911
Due to this errors I can't Achieve the APK or AAB files.
I have created a demo project with same issues and uploaded here.
My VS version 17.8.1
Developer technologies | .NET | .NET MAUI
-
Anonymous
2023-11-23T03:36:22.7233333+00:00 Which platform do you want to develop? Android and IOS?
I find this PCLStorage nuget package just support Android platform, you cannot install it in iOS, windows and maccatalyst platform.
You need to check the packages that support platforms, then set PackageReference for different nuget packages for differet platform like following code in the csproj.
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android'"> <PackageReference Include="Castle.Core" Version="5.1.1" /> <PackageReference Include="CommunityToolkit.Maui" Version="5.3.0" /> ... </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == 'net7.0-ios'"> <PackageReference Include="Castle.Core" Version="5.1.1" /> <PackageReference Include="CommunityToolkit.Maui" Version="5.3.0" /> ... </ItemGroup>
-
Sreejith Sreenivasan • 1,001 Reputation points
2023-11-23T06:51:08.6+00:00 @Leon Lu (Shanghai Wicresoft Co,.Ltd.)
Which platform do you want to develop? Android and IOS?
I am trying to create APK file for Android platform. Before that when I run the rebuilding in release mode I am getting these errors.
I find this PCLStorage nuget package just support Android platform, you cannot install it in iOS, windows and maccatalyst platform.
I have created APK file With
PCLStorage
package, that time I didn't face any issue.I installed
Plugin.Firebase
andPlugin.Firebase.Crashlytics
recently, after that only I am facing this build errors.Did you get a chance to check the demo project I have provided? Are you able to rebuild it in release mode and able to create an APK file?
-
Sreejith Sreenivasan • 1,001 Reputation points
2023-11-23T07:18:52.23+00:00 @Leon Lu (Shanghai Wicresoft Co,.Ltd.)
I have installed Visual Studio 17.9.0 Preview version and in that also getting same list of errors.
-
Anonymous
2023-11-23T08:05:30.8133333+00:00 Here is my editted
.csproj
file, you can copy it to your FirebaseDemo.csproj file and clean, rebuild your project. And release it.<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>net7.0-android;net7.0-ios</TargetFrameworks> <ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android'"> <PackageReference Include="Castle.Core" Version="5.1.1" /> <PackageReference Include="CommunityToolkit.Maui" Version="5.3.0" /> <PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" /> <PackageReference Include="FFImageLoadingCompat" Version="0.1.1" /> <PackageReference Include="FFImageLoadingCompat.Maui" Version="0.1.1" /> <PackageReference Include="FFImageLoadingCompat.Svg" Version="0.1.1" /> <PackageReference Include="FFImageLoadingCompat.Svg.Maui" Version="0.1.1" /> <PackageReference Include="FFImageLoadingCompat.Transformations" Version="0.1.1" /> <PackageReference Include="Microsoft.AppCenter.Analytics" Version="5.0.2" /> <PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.2" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" /> <PackageReference Include="NETStandard.Library" Version="2.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="PCLStorage" Version="1.0.2" /> <PackageReference Include="Plugin.MediaManager.Forms" Version="1.2.2" /> <PackageReference Include="Plugin.Permissions" Version="6.0.1" /> <PackageReference Include="RGPopup.Maui" Version="1.0.2" /> <PackageReference Include="sqlite-net-pcl" Version="1.8.116" /> <PackageReference Include="Stripe.net" Version="42.3.0" /> <PackageReference Include="Twilio" Version="6.11.0" /> <PackageReference Include="Xam.Plugin.Connectivity" Version="3.2.0" /> <PackageReference Include="Xam.Plugin.LatestVersionStore" Version="2.1.2" /> <PackageReference Include="Xam.Plugin.Media" Version="6.0.2" /> <PackageReference Include="Xam.Plugin.SimpleAudioPlayer" Version="1.6.0" /> <PackageReference Include="Xamarin.Essentials" Version="1.8.0" /> <PackageReference Include="Xamarin.Plugins.Clipboard" Version="2.3.0" /> <PackageReference Include="Plugin.Firebase" Version="2.0.7" /> <PackageReference Include="Plugin.Firebase.Crashlytics" Version="2.0.1" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android'"> <PackageReference Include="Xamarin.AndroidX.Core" Version="1.12.0.2" /> <PackageReference Include="Xamarin.AndroidX.Collection" Version="1.3.0.1" /> <PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.3.0.1" /> <PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.8.0.1" /> </ItemGroup> </Project>
-
Anonymous
2023-11-23T08:08:14.9133333+00:00 I am trying to release your demo, because here are many nuget packages, it will spend some times to build and release. I post my csproj file to answers, becuase it is too long, I cannot post it to the comment. You can try it; I am trying to generate an apk.
-
Sreejith Sreenivasan • 1,001 Reputation points
2023-11-23T08:32:45.6633333+00:00 @Leon Lu (Shanghai Wicresoft Co,.Ltd.)
I removed the firebase packages and commented all the firebase related codes, at that time I have no issue for creating the APK file and rebuilding the app in release mode.
Can you do something on this issue? I am stuck on this for one week. -
Anonymous
2023-11-23T08:38:24.6833333+00:00 Do you just want to generate apk now? If so, I will remove other platforms and try to release application only for android platform.
-
Anonymous
2023-11-23T08:49:35.2933333+00:00 I can generate an apk, I edited following csproj file.
-
Sreejith Sreenivasan • 1,001 Reputation points
2023-11-23T09:10:26.8333333+00:00 Do you just want to generate apk now? If so, I will remove other platforms and try to release application only for android platform.
I face this issues when I try to rebuild the app in release mode, I need both frameworks on my project.
-
Sreejith Sreenivasan • 1,001 Reputation points
2023-11-23T09:12:04.32+00:00 @Leon Lu (Shanghai Wicresoft Co,.Ltd.) It only has android framework, so what should I do for iOS platform? Can you tell which package causes the errors?
-
Anonymous
2023-11-23T09:23:24.0966667+00:00 I will test it tomorrow for iOS nugget packages.
-
Sreejith Sreenivasan • 1,001 Reputation points
2023-11-23T10:39:10.8233333+00:00 @Leon Lu (Shanghai Wicresoft Co,.Ltd.)
I am able to rebuild in release mode and created the APK file when targeting android project alone as per your suggestion. But I need iOS project too, waiting for your response.
-
Anonymous
2023-11-24T02:44:44.7733333+00:00 I try to enable the iOS platform with above new .csproj file in the answer; I can get same issue that you have reported in the GitHub repo:https://github.com/TobiasBuchholz/Plugin.Firebase/issues/231.
https://github.com/TobiasBuchholz/Plugin.Firebase/issues/199
This issue is related to the build path is too long, you can copy your project to the Mac and build it.
Or use window 10 devices, download the nuget.exe, create a new folder in the C disk like
C:\NuGet
, copy nuget.exe to the C:\NuGetNext, you need to add the new environment property. Find the key called Path, add the value of C:\NuGet
In the end, copy your project to root path of C disk, then open the command line, navigate to the
C:\FirebaseDemo>
bycd
command, executenuget retore
by command line, open the VS, these errors disappear. -
Sreejith Sreenivasan • 1,001 Reputation points
2023-11-24T05:15:52.09+00:00 @Leon Lu (Shanghai Wicresoft Co,.Ltd.)
I use windows 10 device and created
Nuget
folder in c drive and added nuget.exe file.Then added the
C:\NuGet
path on thesystem variables
. Is it under the system variables or user variables(Top list)?Then pasted the project on c drive and opened it on cmd and run the nuget restore
After that I opened the project in VS and rebuild in release mode and again I am getting the same list of errors.
I tried on my real project and there also same errors.
-
Anonymous
2023-11-24T05:39:08.8966667+00:00 Did you enable the long path? If you enabled, please restart your computer.
-
Sreejith Sreenivasan • 1,001 Reputation points
2023-11-24T05:57:43.65+00:00 @Leon Lu (Shanghai Wicresoft Co,.Ltd.) I have not enabled long path.
I tried it via
powershell
and getting below error.Also tried directly from the Registry Editor.
But getting error alert like below.
Do we need any admin access to enable this?
-
Anonymous
2023-11-24T06:01:16.1766667+00:00 Do we need any admin access to enable this?
Yes, you need it, you can copy your demo to the Mac as well and build it, if you do not access the admin permission.
-
Sreejith Sreenivasan • 1,001 Reputation points
2023-11-24T08:16:01.3066667+00:00 @Leon Lu (Shanghai Wicresoft Co,.Ltd.) Now I enabled the long path on windows machine and tried rebuilding, again same set of errors.
Any other set up is pending to add?
In Mac I have Xcode version issues, So I can't build on it.
-
Anonymous
2023-11-24T08:34:22.28+00:00 You can close VS and execute
nuget retore
by command line, after that do not use VS to rebuild it. If I use VS build it, I will get the same issue. This issue is related to the Plugin.Firebase, I think wait for author's update, it is good idea. -
Sreejith Sreenivasan • 1,001 Reputation points
2023-11-24T09:43:08.0433333+00:00 @Leon Lu (Shanghai Wicresoft Co,.Ltd.) Without build in VS also shows error like below:
-
Sreejith Sreenivasan • 1,001 Reputation points
2023-11-27T06:42:23.02+00:00 @Leon Lu (Shanghai Wicresoft Co,.Ltd.) Any update on this?
-
mjs • 25 Reputation points
2023-11-27T10:24:28.68+00:00 Updated: Ignore this comment, I had some old stuff in my bin/obj - still getting the same error after the changes described in this comment.
I had a similar issue, for me it helped to add this:
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'"> <PackageReference Include="Xamarin.Firebase.Messaging" Version="123.1.1.1" /> <PackageReference Include="Xamarin.Google.Dagger" Version="2.44.2.1" /> <!-- TODO check if we can remove the next 2 lines. Workaround for Xamarin.Firebase.Messaging --> <PackageReference Include="Xamarin.AndroidX.Activity" Version="1.7.2.1" /> <PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.7.2.1" /> </ItemGroup>
and afterwards I got an error from crashlytics, for that I needed to add a file under:
Platforms/Android/Resources/values/strings.xml
with a fake id (probably only because we don't use crashlytics but it needs an id to build)
<?xml version="1.0" encoding="utf-8"?><resources> <string name="com.crashlytics.android.build_id">1</string></resources>
maybe it helps.
-
Sreejith Sreenivasan • 1,001 Reputation points
2023-11-27T10:37:57.17+00:00 @mjs I have already added a section like below:
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android'"> <PackageReference Include="Xamarin.AndroidX.Core" Version="1.12.0.2" /> <PackageReference Include="Xamarin.AndroidX.Collection" Version="1.3.0.1" /> <PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.3.0.1" /> <PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.8.0.1" /> </ItemGroup>
Do I need to keep it or not?
-
Sreejith Sreenivasan • 1,001 Reputation points
2023-11-27T10:51:51.6566667+00:00 @mjs I already had a
strings.xml
file under below path:Platforms/Android/Resources/values/strings.xml
I commented the above section and added your suggestion but I am getting below error:
Severity Code Description Project File Line Suppression State Error JAVA0000 Error in C:\Users\MyName\.nuget\packages\xamarin.androidx.collection.jvm\1.3.0.1\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class: Type androidx.collection.ArrayMapKt is defined multiple times: C:\Users\MyName\.nuget\packages\xamarin.androidx.collection.jvm\1.3.0.1\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class, C:\Users\MyName\.nuget\packages\xamarin.androidx.collection.ktx\1.2.0.5\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection-ktx.jar:androidx/collection/ArrayMapKt.class Compilation failed java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\MyName\.nuget\packages\xamarin.androidx.collection.jvm\1.3.0.1\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection-jvm.jar androidx/collection/ArrayMapKt.class at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:98) at com.android.tools.r8.D8.main(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:4) Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\MyName\.nuget\packages\xamarin.androidx.collection.jvm\1.3.0.1\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class at Version.fakeStackEntry(Version_3.3.75.java:0) at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:75) at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:28) at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:27) at com.android.tools.r8.internal.Fj.b(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:2) at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:22) at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:17) at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:85) ... 1 more Caused by: com.android.tools.r8.internal.f: Type androidx.collection.ArrayMapKt is defined multiple times: C:\Users\MyName\.nuget\packages\xamarin.androidx.collection.jvm\1.3.0.1\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class, C:\Users\MyName\.nuget\packages\xamarin.androidx.collection.ktx\1.2.0.5\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection-ktx.jar:androidx/collection/ArrayMapKt.class at com.android.tools.r8.internal.JT.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:14) at com.android.tools.r8.internal.JT.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:22) at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:33) at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:10) at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056) at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:6) at com.android.tools.r8.graph.B2$a.e(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:4) at com.android.tools.r8.dex.b.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:110) at com.android.tools.r8.dex.b.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:28) at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:25) at com.android.tools.r8.D8.d(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:606) at com.android.tools.r8.D8.c(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:1) at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:24) ... 5 more MyProjectName
Any idea regarding this?
-
mjs • 25 Reputation points
2023-11-27T12:14:47.8366667+00:00 Never mind, after cleaning my bin/obj I get the error again.
-
Sreejith Sreenivasan • 1,001 Reputation points
2023-11-27T12:42:30.01+00:00 @mjs But I am not able to run the application due to this error?
-
mjs • 25 Reputation points
2023-11-29T13:10:49.8733333+00:00 I still had no luck. After rolling back to
<PackageReference Include="Plugin.Firebase" Version="2.0.5" /> <PackageReference Include="Xamarin.Firebase.Messaging" Version="123.1.1.1" /> <PackageReference Include="Xamarin.Google.Dagger" Version="2.44.2.1" /> <PackageReference Include="Xamarin.AndroidX.Activity" Version="1.7.2.1" /> <PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.7.2.1" />
and deleting all bin/obj folders it compiles again, but that's not really a solution.
I think we need support from Microsoft, as the error occurs after updating Xamarin.AndroidX.Activity to some 1.8.*
-
Sreejith Sreenivasan • 1,001 Reputation points
2023-11-29T13:48:21.42+00:00 Hi @mjs,
Leon Lu (Shanghai Wicresoft Co,.Ltd.) suggested this is an issue with the plugin firebase, I already opened a ticket on GitHub. So lets wait for author's update.
https://github.com/TobiasBuchholz/Plugin.Firebase/issues/231
-
Sreejith Sreenivasan • 1,001 Reputation points
2023-12-01T13:52:45.2266667+00:00 @Leon Lu (Shanghai Wicresoft Co,.Ltd.) @mjs
This issue is related to the Plugin.Firebase, I think wait for author's update, it is good idea.
Author updated that he can't reproduce this issue on his side. I shared a demo and that also working well on his side.
Is the demo I shared is working on your side?
https://github.com/TobiasBuchholz/Plugin.Firebase#android-specifics
-
Sreejith Sreenivasan • 1,001 Reputation points
2023-12-01T15:48:49.7033333+00:00 @Leon Lu (Shanghai Wicresoft Co,.Ltd.)
If I target only android then no errors and able to build the APK file. So is these issues are really due to the plugin or iOS platform?
Sign in to comment