Compile iOS app against older Mono framework version in Xamarin Studio - ios

I'd like to debug my iOS app using an older version of the Mono framework so that I can see how things behaved with an older version of the Mono.Data.Sqlite assembly.
How can I tell Xamarin Studio to use an older version?

You can assign MD_MTOUCH_SDK_ROOT to point to an alternative install location. This should be the root directory that contains bin/mtouch.
You can set/export this as an env. variable to points to your alternative Xamarin.iOS framework and then launch Xamarin Studio (or VS4M) from the same shell.
Or you could assign it within your .csproj file.
Ref: Xamarin.MonoTouch.CSharp.targets

You can downgrade to an earlier version of Xamarin simply by running an older installer. Here's more information on where to find the installers and how to use them: How do I downgrade to an older version of Xamarin?

Related

Xamarin target framework is not update

I recently installed android sdk v10 (API 29) in order to set the target framework in my application to v10. But I still can't find it in my application property.
enter image description here
I tried to reload the project but it did not work.
Help?
What's your visual studio version ? Is your Xamarin installation up to date? I suspect that your version of Xamarin.Android is 7.x which means that you won't be able to target Android 8.0 or above even if they are installed through the SDK manager.
You can check the version from Help > About Microsoft Visual Studio

How can I target Android 4.1 in Visual Studio 2019?

I have VS2017 and VS2019 installed side by side on my Windows 10 machine.
I can not compile Xamarin Android 4.1 projects (in VS2019) unless I upgrade them to 4.4 which seems to be the minimum Android SDK version I can target in VS2019. VS2017 compiles fine.
If I create a new Xamarin Android project in VS2019 I can select from 4.4 and above, but in VS2017 I can target right back to 2.3.
Both Visual Studio Xamarin settings are pointing to the same location for the android-sdk (which is on my D: drive, but I did copy it to the standard install location to verify it was not using this as a default, which made no difference)
VS2019 Minimum Android Version
VS2017 Minimum Android Version
Is it possible to target Android 4.1 using VS2019?
Use the following when making decisions with your Android versions:
minSdkVersion (lowest possible) <=
targetSdkVersion == compileSdkVersion/TargetFrameworkVersion (latest SDK)
It's also worthwhile to consider the Android Dashboard to understand how many devices are running a specific version of Android.
https://developer.android.com/about/dashboards
Selecting a higher "Compile using Android version" still lets the project compile.
Under the Android Manifest tab, you can still select the older Minimum and Target Android version allowing VS2019 to be used with this solution/project that uses an older Target Version.
Per the tooltip, Target Framework is only used at runtime.

Build failed with error Remotebuild requires your projects to use cordova-ios 4.3.0 or greater with Xcode 8.3. Please update your cordova-ios version

I am aiming to deploy a mobile application to the iOS platform using codes developed in Visual Studio for an Android phone. I am unable to open the Visual Studio file on my Macbook (macOS High Sierra ver.10.13.6) as Visual Studio here does not seem to support .jsproj files. As such, I have attempted following the instructions in the link below to run a remotebuild on my mac while debugging codes and seeing an iOS simulator on my Windows computer.
https://learn.microsoft.com/en-us/visualstudio/cross-platform/tools-for-cordova/first-steps/ios-guide?view=toolsforcordova-2017#run-on-simulator
I was able to get the remotebuild running, however, I came across the error where it required my projects to use cordova-ios 4.3.0 or greater with Xcode 8.3. As my windows computer does not have Xcode, I turned to my macbook and tried updating and adding the Cordova iOS platform through the terminal, where it said "Current working directory is not a Cordova-based project." I have searched the error up and it said that it required my Visual Studio project to be open, which I am unable to do so as my file is not supported in the Mac version of Visual Studio.
The iOS version in my Windows Visual Studio is currently 4.2.0 and I am unsure how to get about updating it. I have seen the link below but in only applies to Macbook, where I cannot open the Visual Studio project file.
Install specific version of Cordova CLI in Visual Studio 2017
I have installed node.js as well as Git, also attempting to include/update the Cordova iOS platform through the command prompt (Once again unsure if that was the method, but I tried), however, the command prompt did not recognise the update to cordova. Under the toolset in Visual Studio, I have tried ticking on the checkbox under Cordova platforms to take the latest patch, where ~4.2.0 appears, but still does not update.
I am still new to coding and things seem very foreign to me, if I have missed out anything vital or am doing something fatally wrong, please do enlighten me.

Can't get Visual Studio to target the correct Android version

I have a problem getting Xamarin.Android to target the newest version of Android.
The problem arised when I tried installing the Xamarin.GooglePlayServices.Maps NuGet package, that required me to run at least Android 8.
From my Android SDK manager, I can see that Android 8 and 8.1 is the only SDK platforms installed:
However, when I start a new project in Visual Studio 2017, and go into the project properties, and extend the Compile using Android version dropdown, it's populated like this:
So here I can choose only 7.1 (that is marked as latest platform), and 8.0 and 8.1 is marked with (Requires installation). Android 7.1 SDK that VS uses is not even installed on my machine.
So the questions is: What do I have to do to select Android 8.1 as the Target Framework inside Visual Studio?
What do I have to do to select Android 8.1 as the Target Framework inside Visual Studio?
In your VS, Tools->Android->Android SDK Manager, you will see Android SDK for VS, it default path is C:\Program Files (x86)\Android\android-sdk.
In your AS, Android SDK's path is C:\Users\user name\AppData\Local\Android\Sdk
Now, you can change the VS's Android SDK's path to C:\Users\user name\AppData\Local\Android\Sdk, but we don't suggest you do that, it may cause VS compilation errors at some point, and by then you cannot find the cause of the problem.
So, you can download the Android 8 from VS again.

APK fails to be installed on any device

I'm new in the Xamarin Development world so I installed Visual Studio 2017 with all the needed cross compiler features.
After downloading and updating the SDKs for Android API 23, 24, 25 and 26 and some corresponding emulator images I got the emulators starting up.
I created a base Xamarin Android App within VS, compiled and deployed it to the simulator.
By deploying/installing the generated APK to the simulator I get the following error:
Failure [INSTALL_FAILED_INVALID_APK: Package couldn't be installed in /data/app/BlankAndroid.BlankAndroid-1: Package /data/app/BlankAndroid.BlankAndroid-1/base.apk code is missing]
It doesn't matter which SDK I choose as “Target Framework” or which Simulator I choose (Android 6, Android 7 or 7.1). The result is the same: The apk is not installed, but the “Mono Shared Runtime” are present and will be updated.
I figured out that the created apk file does not contain a file “classes.dex” or any oder dex files just some ressources. A file “classes.zip” in the directory “obj\Debug\android\bin\classes” with the generated java classes out of my C# is present. These files should be compiled with the DEX-Compiler to the classes.dex file, when I understood correctly.
Even other sample projects from the Internet have exactly the same result.
What do I do wrong?
The problem got solved by fresh installing the Android SDK and all related components. It seemed to have a SDK missmatch between an old Google Android SDK and the new installed Xamarin Android SDK.
I faced the same problem and tried many solutions from the search in web but this one to an extent solved that deploy failure issue.
In the emulator, open settings -> Apps -> Uninstall your app if it is listed
Deploy the app from visual studio again.
This solved the problem that said base.apk is missing.
Try setting your project back to the current recommended defaults. Remove all of the following properties from the .csproj file:
AndroidEnableMultiDex
AndroidDexGenerator
AndroidLinkTool
AndroidDexTool
This will let Xamarin.Android pick the current latest default values, this apply for Visual Studio for Mac and VS 2017-2019

Resources