Xamarin :: Android - Original attribute defined here - xamarin

I have Xamarin Android Project with Target Framework v9.
Recently, I updated my Xamarin Forms to latest version. Then, I am getting below error.
I understand from the error message that I need to update 'Target Framework' from Android 9 to Android 10. I did it.
From that moment, whenever I build my android project in 'Release' mode, I get below error. Building project in 'Debug' mode is fine.
May you please help? I need to submit an update to my Android App. :-(

From the comment of "Lucas Zhang - MSFT":
Please enable the
Use incremental Android packaging system (Aapt2)
which is available under Project Properties. It will resolve the error you posted.

Related

Getting 'Selected scheme "iosApp" does not support "iphonesimulator"' error for Kotlin Multiplatform

I am trying to run the initial example apps generated by the Kotlin Multi Platform Mobile plugin in Android Studio. I followed these steps for my environment setup. The Android Simulator runs correctly, but the iPhone Simulator does not. The Run Configuration has the following error:
Error: Selected scheme "iosApp" does not support "iphonesimulator"
When I run the configuration (ignoring the error), the iPhone simulator does open and appears to load iOS, but it never loads the "Hello, iOS" application that is in Android Studio.
What would cause this?
Version Information:
macOS 12.2.1
Android Studio 2021.1.1 Patch 2
Xcode 13.3
I fixed it with the following method.
Please close the Android Studio.
Go to ~/Library/LaunchAgents/ folder and delete com.jetbrains.AppCode.BridgeService.plist there.
Launch Android Studio with the KMM plugin again. It should work now.
From my tests, it seems that there may be multiple reasons for which we receive this error:
the root folder of the ios project has a different name than the .xcodeproject file. Sometimes it works even if they are different and maybe it matters if we change this name after the frameworks was already connected to the iOS project.
"Other linker flags" were manually copied and they were not copied using the copy button from the Connect the framework to your iOS project. This results to wrong data like:
"$(inherited)",
"-framework",
"shared\n",
instead of
"$(inherited)",
"-framework",
shared,
I managed to fix this by going into Edit Configurations on Android Studio and choosing the location of my XCode project file again. I believe this is an error of the KMM plugin in Android Studio and has yet to be fixed.
Updating Android Studio and KMM plugin worked for me.

Getting Attribute "buttonSize" already defined with incompatible format error after adding Firebase Analytics Nuget

I am trying to enable Firebase Analytics in my Xamarin Forms project. The iOS version goes very well, however, when adding nuget packages in Android project I am getting error while building my project. I am following Using Firebase Analytics in your Xamarin.Forms app to enable firebase in my app. I have added
Xamarin.FireBase.Analytics and Xamarin.FireBase.Analytics.Impl
Nugets. while running my app I am getting weired error attached in the screenshot. Clicking any of those errors takes me to a file "values.xml". In fact there are two identical values.xml files (these files are not located in my android project, but opens when clicking on the errors)
After switch on aapt2 for build the issue was solved for me
i had the same issue with the new 116+ versions.. downgrade to version 71.xx and it solves the problem

Errors when referenace android project to ui test project Xamarin

I have an intruder problem. I have created a xamarin form solution with monoandroid 8.1 and .net standard 2.0 and everything was going fine, but once I added UI test project and add android project as reference I saw 4 errors and when I built it build was successful but the error was still visible.
When I build it in app center it fails and shows me these 4 errors:
errors list
Log from app center
2018-06-11T10:26:21.6746020Z NU1201: Project UserLogin.Android is not
compatible with net471 (.NETFramework,Version=v4.7.1). Project
UserLogin.Android supports: monoandroid81 (MonoAndroid,Version=v8.1)
I solved this problem after update visual studio to latest version

Rider 2018.1 iOS simulator not running after build

I have a Xamarin iOS and Android project with a dotnet standard 2.0 library that is being shared between the two operating systems. When trying to run my iOS project, the project build fine and doesn't give any errors but Rider cannot seem to deploy it to a simulator.
I will give the following error:
I thought it could be the problem what is described here, but that did not help. When running the project in VS on MacOs, the iOS project also build and runs on a simulator.
Failed to load Xamarin Forms project with .NET Standard 2.0 Lib in Rider
Can anyone help me trying to fix this, please?
You are not the only one with this problem, the problem is already reported multiple time in Riders issue tracker:
https://youtrack.jetbrains.com/issue/RIDER-15544
https://youtrack.jetbrains.com/issue/RIDER-15514
https://youtrack.jetbrains.com/issue/RIDER-15419
According to the last issue, it's fixed in Rider 2018.2, which will probably be released pretty soon.

Problems building Xamarin.iOS project with Visual Studio using Xamarin 3. Error 11 The maximum deployment target for iOS is 9.1

We use Xamarin on Windows with Visual Studio to build our app for iOS.
We recently upgraded to Xamarin 4 and found we were not able to build.
Various errors including builds hanging, Linked Away exceptions.
After some effort we decided to revert to Xamarin 3 using the links on this page
https://store.xamarin.com/account/my/subscription/downloads#xamarin3
Where it says "Looking for the version before Xamarin 4? Get the latest stable version of Xamarin 3".
We now cannot build and get the following error:
**Error 178 The maximum deployment target for iOS is 9.1 (current deployment target is 9.2).
Please select an older deployment target in your project's Info.plist.**
In Visual Studio, this setting is selected in the project settings and the only value available is 9.2. If I try and update in the .csproj file xml, it gets overwritten.
I have had a look at all the various versions of Xamarin for Visual Studio and for the Mac (in the show all versions on the above page) and cannot find versions that will allow us to build. i.e. versions with the old build client with matching Xamarin.iOS versions.
Are there matching Xamarin.iOS releases still available for both Mac and windows that use Xamarin 3?
Is there a way I am missing of forcing the SDK value to match the build server?
For what it's worth the answer was in the error message (kind of).
The necessary update to Info.plist was adding the following:
<key>MinimumOSVersion</key>
<string>9.1</string>
This was only apparent after I had noticed that there was an editor called PListEditoryFactory, which gives a ui to edit Info.plist.
The file didn't open in PListEditoryFactory by default, so it just looked like an xml file to me.
In the ui the field needed editing is called 'Deployment Target', needs to be 9.1.
Another curveball was that the error message says that the 'current deployment target ' is 9.2, which was the value selected (and only option) in the iOS project settings TargetSDK dropdown.
What this is for and how it is different to the Info.plist setting I dont know.

Resources