Xamaring.Forms Android 8.0 - Visual Studio 2019 - android

I'm becoming crazy. I want to compile Xamarin.Forms for Android 8.0 with Visual Studio 2019
I setup all correct, I think, but I always get:
Error The $(TargetFrameworkVersion) for App_test32.Android (v8.0) is less than the minimum required $(TargetFrameworkVersion) for Xamarin.Forms (8.1). You need to increase the $(TargetFrameworkVersion) for App_test32.Android. App_test32.Android

You cannot target 8.0 and that's for a reason. Starting from August 1, 2019 Google doesn't accept new apps that doesn't have targetSdkVersion set below Android 9.0 (for new apps).
You can read more about this here (Meet Google Play's target API level requirement) and more specifically here (Target API level requirements for the Play Console).
If you open the second link, you will see that the targetSdkVersion will be bumped even to Android 10, starting from August 3, 2020 (for new apps)
This is what you are seeing - Xamarin has restricted this, so that you don't set it lower that what it must be. Otherwise, you will be able to build it, but you won't be able to upload it. You can see the minimum version set here
However, you can still set it to 8.0, but you will need to downgrade the Xamarin.Forms & Xamarin.Android to a version that is way back - probably even before 4.0. This way you will be able to build the project, but the end result will be the same - you won't be able to upload the app to the PlayStore.
Useful link to get familiar with the difference between Target Framework, Minimum Android Version & Target Android Version from the official docs
Here is the most important comparison:
Minimum Android Version <= Target Android Version <= Target Framework
To sum up, I will quote again the guys from Microsoft (see in the link above):
We recommend that you explicitly set the Target Android version to the latest version of Android that you use to test your app. Ideally, it should be set to the latest Android SDK version – this allows you to use new APIs prior to working through the behavior changes. For most developers, we do not recommend setting the Target Android version to Use Compile using SDK version.

Related

(Unity) Your app currently targets API level 30 and must target at least API level 31

Today I got following warning from Google Play "Your app currently targets API level 30 and must target at least API level 31 to ensure it is built on the latest APIs optimized for security and performance."
How can and where I should specify target API level? To be honest I didn't specify anything. I just recently moved from Unity 2018 to Unity 2020 and got following warning.
How can it be fixed? Thank you in advance
First of all, always ensure you are using the latest stable build of unity. Older versions may not have the new API levels required for the latest android versions.
Then go to:
Edit -> Project Settings -> Player -> Other Settings
If you have selected Android as the Build Platform:
Under the Identification, there will be a Minimum API Level and Target API Level.
Set the Target API Level to automatic, which will be the highest installed. If you won't have an API Level such as 31, it means you need to upgrade your unity version or install the API level manually.
if you have android studio or unchecked the ticks that Unity handles the android SDKs automatically you need to check these two folder
C:\Users\username\AppData\Local\Android\Sdk\build-tools
C:\Users\username\AppData\Local\Android\Sdk\platforms
unity has issue with sdk API 31+ (32 and so on...)
unity will download build-tools based on target sdk on player settings, if you set to automatic, it will download highest version (33 right now), which is problematic,
set target sdk to 31
or set the Target API Level to automatic, unity will search build-tools folder automatically for highest version which you need to remove any 31+ if unity has downloaded before.
if you have android studio targeting 33 for android build u must cut it to desktop and put it back for ur android build.

Creating an Android application supporting Android version 5 and version 9

I am new to Android development. I am told to create an android app that should support android Version 5 (Lollipop) and android Version 9 (Pie). How should I approach this? Should i create 2 different apps supporting Version 5 and Version 9?
Is there any way to make a single app that runs on both version 5 and version 9?
If I use AndroidX, then will it make sure that the app look and function same on both version 5 and 9?
P.S.: I am told to build the app using Xamarin Android Native (not Xamarin Forms).
Thanks.
First you need to understand the following Settings:
Target Framework :Specifies which framework to use in building your application. This API level is used at compile time by Xamarin.Android.
Minimum Android Version:Specifies the oldest Android version that you want your app to support. This API level is used at run time by Android.
Target Android Version:Specifies the version of Android that your app is intended to run on. This API level is used at run time by Android.
Normally, all three Xamarin.Android API levels are set to the same value. On the Application page, set Compile using Android version (Target Framework) to the latest stable API version (or, at a minimum, to the Android version that has all of the features you need)strong text
On the Android Manifest page, set the Minimum Android version to Use Compile using SDK version and set the Target Android version to the same value as the Target Framework version.
If you want to maintain backward compatibility with an earlier version of Android, set Minimum Android version to target to the oldest version of Android that you want your app to support.
Then in you case,you could set the Target Framework version to Android 9.0,and Minimum Android Version to Android 5,Target Android Version to Android 9.0.

How to setup android libraries to support different android versions

I have developed an application for Android in Kotlin. I was assuming that Android studio is taking care of the compatibility of the used libraries and the code once I setup the minimum targetted Android version.
I am getting responses that the app is crashing with noSuchMethodError, which is linked to a listview's .getView() methode.
I am running the app on Android 8, but these errors are reported on Android 6 and 7 randomly.
I was reading different articles about this failure and I am having the feeling that i might need to setup the libraries setting differently in Studio.
In your build.gradle you can specify a minSdk and a targetSdk, while the targetSdk specifies as the name says the target audience and is in general the newest version e.G. 29, your minSdk takes care of your minimum supported version.
So if you have minSDK 19, Android Studio will show Warnings in your code whenever a method or class is not compatible with devices running sdk 19.
Anyway this might not solve your "noSuchMethodError".

Xamarin Targetframeworkversion

I am trying to make a basic Xamarin.forms (pcl) application (in Visual studio 2017) and i want to Target Lolipop (5.0.0, api level 21).
So i made a basic Xamarin solution and i adjusted the Android properties all to Android 5.0 lollipop
Compile using Android version "Android 5.0 (Lollipop)"
Minimum Android to target "Android 5.0 (API Level 21 - Lollipop)"
Target Android Version "Android 5.0 (API Level 21 - Lollipop)"
Unfortunately in my warning list i get the following
Severity Code Description Project File Line Suppression State
Warning The $(TargetFrameworkVersion) for Xamarin.Forms.Platform.dll (v7.0) is greater than the $(TargetFrameworkVersion) for your project (v5.0). You need to increase the $(TargetFrameworkVersion) for your project. Prolang.Android C:\Projects\Prolang\Prolang\Prolang.Android\Prolang.Android.csproj
If i google for this error most people say to indeed update your android project to use the latest Targetframework version. But in my case i really want to only be able to call Api calls that are available to level 21 aka Android 5.0 Lollipop. As in i want the compile time safety net that i only use Api Calls from Api level 21.
To me it seems like i have to downgrade my xamarin.Forms dll to a version that is made specifically for android lollipop since the one i use right now targets a higher version.
So should i downgrade my xamarin.forms dll to achieve this and get rid of the error? And if i downgrade to what version do i need to downgrade so i target Android 5.0 Lollipop? This information is all pretty unclear to me.
Xamarin.Forms is designed using the Android's support libraries so it will run on a wide range of APIs without any additional actions from the developer.
If you are using native APIs via Xamarin.Android (assumably via Forms' Dependency Service) then yes you would have to be aware of the API level of the method calls.
That said, since Xamarin.Forms uses the com.android.support.* libraries and you would have to have to a Forms versions that uses com.android.support:design:21.x.x and the associated Android build tools for API 21.
Now you can review the package dependancies and you will see that your choices are Forms' is 1.4
`1.4.0.6336-pre1` to `1.4.4.6449`
Note: v1.5.x moved to version 22 of the Android support libraries
IMHO using Forms's 1.4 would a bad mistake due to its age and the mountain of improvements and bugs fixes since 2015, you are so much better off:
Using the latest Forms version
Set the Framework version to latest (7.1)
Set the Target Android version to Android 5.0 (API Level 21)
Set the Minimum Android version to whatever you need...
Forgo the compile time API checks
Check runtime API issues via API-21 devices and emulators

Can I only install the newest Android API to target lower API Version?

Say I wanna make an app with :
android:minSdkVersion="8"
android:targetSdkVersion="22"
My questions :
Do I need to install both "min SDK Version" as well as the target SDK version?
How if I only have SDK Version of 23 only? Can I make such setting? Or do I need to have both 22 as well as 8?
Can I debug such app with API / SDK Ver 21 phone?
Is it enough to only have the latest SDK version to develop any kind of app?
It is okay if there's any source (link) to comprehensive rule about such ruling, since I didn't found it even after extensive searching.
P.S. I don't know if this info is needed, but the app I wanna make is a libgdx game app.
Thanks
No. (the other answer is wrong)
You only need to have the version that you building with (compileSdkVersion in build.gradle). If you only have 23, then build with 23.
Usually, you should target the same version you build with. However, libgdx is not always fully tested with the latest Android. Check here under Android build version to see what it has been tested for. This is the SDK level you should should target if you want to be sure not to have any problems. Right now, it is version 20 of Android.
I have been targeting Android 22 without issue (that I know of), though. I haven't yet released something higher than 20 yet so no guarantees that it's perfectly safe.
Yes.
Yes. Generally, the target SDK version and the build SDK version should match, but it works if you target a lower version than you're building with.
Targeting a later API basically changes some default behavior of apps. Theoretically, you should be testing on devices spanning the full range of API levels that you support, but in practice this is unnecessary for a libgdx game. But if you target a version that's too old, you might miss out on some newer features. For example, if you target <19, immersive mode (which is desirable for most games) cannot be supported.
Yes you need to install
If you have SDK Version of 23 only but you want to build it in version 22 then also you need to install vesrsion 22 SDK.
Yes you can easily debug such app with API / SDK Ver 21 phone.
I think its enough.

Categories

Resources